diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2018-05-12 11:54:35 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2018-05-12 11:54:35 +0000 |
commit | 15de2de8449b4f5063f93578ae68aa0bc79a205c (patch) | |
tree | f0a7e3230212205e7ff88a2900de97026940f63c /util/log.c | |
parent | 689b65913bba5320ef50befddf4743c6dafde873 (diff) |
Notes
Diffstat (limited to 'util/log.c')
-rw-r--r-- | util/log.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/util/log.c b/util/log.c index 439541a7ce4a..c14b45834add 100644 --- a/util/log.c +++ b/util/log.c @@ -103,8 +103,12 @@ log_init(const char* filename, int use_syslog, const char* chrootdir) use_syslog?"syslog":(filename&&filename[0]?filename:"stderr")); lock_quick_lock(&log_lock); } - if(logfile && logfile != stderr) - fclose(logfile); + if(logfile && logfile != stderr) { + FILE* cl = logfile; + logfile = NULL; /* set to NULL before it is closed, so that + other threads have a valid logfile or NULL */ + fclose(cl); + } #ifdef HAVE_SYSLOG_H if(logging_to_syslog) { closelog(); |