Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
3e835154
Kaydet (Commit)
3e835154
authored
Eyl 03, 2014
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
coverity#1019334 Explicit null dereferenced
Change-Id: I22b85cbfda1c1bd705b35095e03cfae4071d2fb7
üst
eef839fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
74 deletions
+5
-74
main.c
soltools/mkdepend/main.c
+5
-74
No files found.
soltools/mkdepend/main.c
Dosyayı görüntüle @
3e835154
...
...
@@ -115,7 +115,7 @@ char *directives[] = {
/******* function declarations ********/
/******* added by -Wall project *******/
void
redirect
(
char
*
line
,
char
*
makefile
);
void
redirect
(
char
*
makefile
);
struct
inclist
inclist
[
MAXFILES
],
*
inclistp
=
inclist
;
...
...
@@ -375,7 +375,7 @@ int main(int argc, char **argv)
*
incp
++
=
defincdir
;
}
redirect
(
startat
,
makefile
);
redirect
(
makefile
);
/*
* catch signals.
...
...
@@ -650,81 +650,12 @@ int rename (char *from, char *to)
}
#endif
/* USGISH */
void
redirect
(
char
*
line
,
char
*
makefile
)
void
redirect
(
char
*
makefile
)
{
FILE
*
fdout
;
fdout
=
freopen
(
makefile
,
"wb"
,
stdout
)
;
// binary mode please
fdout
=
makefile
?
freopen
(
makefile
,
"wb"
,
stdout
)
:
NULL
;
// binary mode please
if
(
fdout
==
NULL
)
fatalerr
(
"cannot open
\"
%s
\"\n
"
,
makefile
);
(
void
)
line
;
// don't need any of that nonsense
#if 0
struct stat st;
FILE *fdin, *fdout;
char backup[ BUFSIZ ],
buf[ BUFSIZ ];
boolean found = FALSE;
int len;
/*
* if makefile is "-" then let it pour onto stdout.
*/
if (makefile && *makefile == '-' && *(makefile+1) == '\0')
return;
/*
* use a default makefile is not specified.
*/
if (!makefile) {
if (stat("Makefile", &st) == 0)
makefile = "Makefile";
else if (stat("makefile", &st) == 0)
makefile = "makefile";
else
fatalerr("[mM]akefile is not present\n");
}
else
stat(makefile, &st);
if ((fdin = fopen(makefile, "r")) == NULL)
fatalerr("cannot open \"%s\"\n", makefile);
sprintf(backup, "%s.bak", makefile);
unlink(backup);
#if defined(WIN32)
fclose(fdin);
#endif
if (rename(makefile, backup) < 0)
fatalerr("cannot rename %s to %s\n", makefile, backup);
#if defined(WIN32)
if ((fdin = fopen(backup, "r")) == NULL)
fatalerr("cannot open \"%s\"\n", backup);
#endif
if ((fdout = freopen(makefile, "w", stdout)) == NULL)
fatalerr("cannot open \"%s\"\n", backup);
len = strlen(line);
while (!found && fgets(buf, BUFSIZ, fdin)) {
if (*buf == '#' && strncmp(line, buf, len) == 0)
found = TRUE;
fputs(buf, fdout);
}
if (!found) {
if (verbose)
warning("Adding new delimiting line \"%s\" and dependencies...\n",
line);
puts(line); /* same as fputs(fdout); but with newline */
} else if (append) {
while (fgets(buf, BUFSIZ, fdin)) {
fputs(buf, fdout);
}
}
fflush(fdout);
#if defined(USGISH) || defined(USE_CHMOD)
chmod(makefile, st.st_mode);
#else
fchmod(fileno(fdout), st.st_mode);
#endif /* USGISH */
fclose
(
fdin
);
#endif
fatalerr
(
"cannot open
\"
%s
\"\n
"
,
makefile
?
makefile
:
"<NULL>"
);
}
void
fatalerr
(
char
*
msg
,
...)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment