From: Derrick Brashear Date: Fri, 5 Oct 2007 04:22:27 +0000 (+0000) Subject: vol-salvager-avoid-logging-to-nothing-20071004 X-Git-Tag: BP-openafs-windows-kdfs-ifs~469 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=409a3457033c4fe00074f22def3b29f630367dad;p=packages%2Fo%2Fopenafs.git vol-salvager-avoid-logging-to-nothing-20071004 check for logFile before using --- diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index e5158e91f..6736133dd 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -3427,11 +3427,11 @@ Log(const char *format, ...) syslog(LOG_INFO, "%s", tmp); } else #endif - { - gettimeofday(&now, 0); - fprintf(logFile, "%s %s", TimeStamp(now.tv_sec, 1), tmp); - fflush(logFile); - } + if (logFile) { + gettimeofday(&now, 0); + fprintf(logFile, "%s %s", TimeStamp(now.tv_sec, 1), tmp); + fflush(logFile); + } } void @@ -3448,12 +3448,12 @@ Abort(const char *format, ...) syslog(LOG_INFO, "%s", tmp); } else #endif - { - fprintf(logFile, "%s", tmp); - fflush(logFile); - if (ShowLog) - showlog(); - } + if (logFile) { + fprintf(logFile, "%s", tmp); + fflush(logFile); + if (ShowLog) + showlog(); + } if (debug) abort();