]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Make fatal() exit like it should even if CCACHE_LOGFILE isn't set
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 28 Feb 2010 13:14:06 +0000 (14:14 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 28 Feb 2010 13:29:48 +0000 (14:29 +0100)
util.c

diff --git a/util.c b/util.c
index b704dc98d6317eb560eaaa2680e7ddb73c84dd90..bf296c9c305c5fb68372cc3a38a108fe151ec1b1 100644 (file)
--- a/util.c
+++ b/util.c
@@ -67,16 +67,18 @@ void fatal(const char *format, ...)
        va_list ap;
        extern char *cache_logfile;
 
-       if (!cache_logfile) return;
-
-       if (!logfile) logfile = fopen(cache_logfile, "a");
-       if (!logfile) return;
-
        va_start(ap, format);
 
-       fprintf(logfile, "[%-5d] FATAL: ", getpid());
-       vfprintf(logfile, format, ap);
-       fflush(logfile);
+       if (cache_logfile) {
+               if (!logfile) {
+                       logfile = fopen(cache_logfile, "a");
+               }
+               if (logfile) {
+                       fprintf(logfile, "[%-5d] FATAL: ", getpid());
+                       vfprintf(logfile, format, ap);
+                       fflush(logfile);
+               }
+       }
 
        fprintf(stderr, "ccache: FATAL: ");
        vfprintf(stderr, format, ap);