Make fatal() exit like it should even if CCACHE_LOGFILE isn't set

This commit is contained in:
Joel Rosdahl 2010-02-28 14:14:06 +01:00
parent 614a19141a
commit 20cca3c195

18
util.c
View File

@ -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);