Use line buffering on log files.
This makes sure the contents are written on the disk, so the user can read the log.
This commit is contained in:
@@ -216,8 +216,13 @@ void log_setup() {
|
||||
die("Could not open logfile");
|
||||
|
||||
dup2(log_fd, STDOUT_FILENO);
|
||||
setvbuf (stdout, NULL, _IOLBF, BUFSIZ);
|
||||
|
||||
if (!config.errfile)
|
||||
{
|
||||
dup2(log_fd, STDERR_FILENO);
|
||||
setvbuf (stderr, NULL, _IOLBF, BUFSIZ);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.errfile) {
|
||||
@@ -228,6 +233,7 @@ void log_setup() {
|
||||
die("Could not open logfile");
|
||||
|
||||
dup2(err_fd, STDERR_FILENO);
|
||||
setvbuf (stderr, NULL, _IOLBF, BUFSIZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user