1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Report system error message when fopen fails

This commit is contained in:
dmiller
2020-12-28 17:51:16 +00:00
parent f6fbb29481
commit ef2bafb09c
9 changed files with 13 additions and 13 deletions

View File

@@ -1101,14 +1101,14 @@ int log_open(int logt, bool append, char *filename) {
o.logfd[i] = stdout;
o.nmap_stdout = fopen(DEVNULL, "w");
if (!o.nmap_stdout)
fatal("Could not assign %s to stdout for writing", DEVNULL);
pfatal("Could not assign %s to stdout for writing", DEVNULL);
} else {
if (append)
o.logfd[i] = fopen(filename, "a");
else
o.logfd[i] = fopen(filename, "w");
if (!o.logfd[i])
fatal("Failed to open %s output file %s for writing", logtypes[i],
pfatal("Failed to open %s output file %s for writing", logtypes[i],
filename);
}
return 1;