From: Derrick Brashear Date: Fri, 5 Oct 2007 04:23:52 +0000 (+0000) Subject: DEVEL15-vol-salvager-avoid-logging-to-nothing-20071004 X-Git-Tag: openafs-devel-1_5_26~50 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=15463f6dbc3177a429d1d2bf5cf9ffa593a1d861;p=packages%2Fo%2Fopenafs.git DEVEL15-vol-salvager-avoid-logging-to-nothing-20071004 check for logFile before using (cherry picked from commit 409a3457033c4fe00074f22def3b29f630367dad) --- diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index d10d3377c..54ea11b52 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();