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