From ea6bb62410aef141f67225c3eac3b03cae285030 Mon Sep 17 00:00:00 2001 From: daixj Date: Mon, 29 Jan 2018 15:21:40 +0800 Subject: [PATCH] log: fix fd checking --- common/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/log.c b/common/log.c index 0bf013e3..50a44e9e 100755 --- a/common/log.c +++ b/common/log.c @@ -331,7 +331,7 @@ internal_config_read_logging(int file, struct log_config *lc, /* setting defaults */ lc->program_name = applicationName; lc->log_file = 0; - lc->fd = 0; + lc->fd = -1; lc->log_level = LOG_LEVEL_DEBUG; lc->enable_syslog = 0; lc->syslog_level = LOG_LEVEL_DEBUG; @@ -604,7 +604,7 @@ log_message(const enum logLevels lvl, const char *msg, ...) pthread_mutex_lock(&(g_staticLogConfig->log_lock)); #endif - if (g_staticLogConfig->fd > 0) + if (g_staticLogConfig->fd >= 0) { writereply = g_file_write(g_staticLogConfig->fd, buff, g_strlen(buff));