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:
Paul Lietar
2013-06-20 17:02:56 +10:00
committed by James Laird
parent b70505fd58
commit ffdde63ecc
+6
View File
@@ -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);
}
}