(logerror): Ensure that logerror() only writes to the log file after log_init()
has been called
This commit is contained in:
parent
8babf97d81
commit
3afb3925a2
1 changed files with 9 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue