Always set standard output to line-buffered

When logging was enabled via the config file, standard output was left
fully buffered. Logs should never be fully buffered.

Thanks to Chang-Li for pointing this out.
This commit is contained in:
Christopher Wellons
2019-04-19 13:00:04 -04:00
parent 6f621b90b1
commit 24bc7639d1

View File

@@ -624,8 +624,7 @@ main(int argc, char **argv)
config_set_port(&config, optarg, 1); config_set_port(&config, optarg, 1);
break; break;
case 'v': case 'v':
if (!loglevel++) loglevel++;
setvbuf(stdout, 0, _IOLBF, 0);
break; break;
case 'V': case 'V':
print_version(); print_version();
@@ -642,6 +641,9 @@ main(int argc, char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Set output (log) to line buffered */
setvbuf(stdout, 0, _IOLBF, 0);
/* Log configuration */ /* Log configuration */
config_log(&config); config_log(&config);