]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-vol-salvager-avoid-logging-to-nothing-20071004
authorDerrick Brashear <shadow@dementia.org>
Fri, 5 Oct 2007 04:23:52 +0000 (04:23 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 5 Oct 2007 04:23:52 +0000 (04:23 +0000)
check for logFile before using

(cherry picked from commit 409a3457033c4fe00074f22def3b29f630367dad)

src/vol/vol-salvage.c

index d10d3377c8fcdd1e89b165952aa9efef482a697b..54ea11b528669264a4e6ff66fbaf5305ec6b176e 100644 (file)
@@ -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();