(logerror): Ensure that logerror() only writes to the log file after log_init()

has been called
This commit is contained in:
Ron Koenderink 2007-03-03 15:23:32 +00:00
parent 8babf97d81
commit 3afb3925a2

View file

@ -89,6 +89,7 @@ logerror(char *format, ...)
p = strchr(msg, '\n');
p[1] = 0;
fputs(msg, stderr);
if (logfile[0] != '\0') {
time(&now);
memcpy(buf, ctime(&now), ctime_len);
buf[ctime_len] = ' ';
@ -96,6 +97,7 @@ logerror(char *format, ...)
return;
write(logf, buf, strlen(buf));
close(logf);
}
va_end(list);
}