nfqws,tpws: always use line buffering for console IO

Forces stdout and stderr to always use line buffering. Note that glibc
does automatically flush on newline iff connected to a terminal, but
that is not the case when running under systemd. See also
https://www.gnu.org/software/libc/manual/html_node/Buffering-Concepts.html
https://www.gnu.org/software/libc/manual/html_node/Controlling-Buffering.html
This commit is contained in:
Ivan Trubach
2025-03-12 11:48:57 +03:00
parent 756603338b
commit a1d29b0c3a
7 changed files with 15 additions and 12 deletions

View File

@@ -391,6 +391,12 @@ void fill_random_az09(uint8_t *p,size_t sz)
}
}
void disable_console_io_buffering(void)
{
setvbuf(stdout, NULL, _IOLBF, 0);
setvbuf(stderr, NULL, _IOLBF, 0);
}
bool set_env_exedir(const char *argv0)
{
char *s,*d;