logging: don't write fatal messages to invalid descriptor

If opening the log file specified with the -l option failed (after
closing all descriptors), the error message is written to an invalid
descriptor as no log file or syslog is opened yet. Fix the code to track
when the output is usable.
This commit is contained in:
Miroslav Lichvar
2018-02-21 12:40:53 +01:00
parent 4da9f74d24
commit 7b98443a13
2 changed files with 16 additions and 16 deletions

View File

@@ -105,7 +105,7 @@ extern void LOG_OpenFileLog(const char *log_file);
/* Log messages to syslog instead of stderr */
extern void LOG_OpenSystemLog(void);
/* Send fatal message also to the foreground process */
/* Stop using stderr and send fatal message to the foreground process */
extern void LOG_SetParentFd(int fd);
/* Close the pipe to the foreground process so it can exit */