diff options
author | mpvader <mvader@victronenergy.com> | 2019-02-03 10:22:49 +0100 |
---|---|---|
committer | Tobias Klauser <tobias.klauser@gmail.com> | 2019-02-03 17:32:30 +0100 |
commit | fdf702ec67f8eefbd3ad5bb63f193dce01ef6201 (patch) | |
tree | 31576ead6ad88d2bd359dbd64ebaf2311b75407a /llmnrd.c | |
parent | e1b6baa4f71f46b6bd2f9a1e4ffbc2e593d14a48 (diff) |
llmnrd: set stdout to line buffering
The log output of llmnrd works well when operated from a terminal; but not when its
stdout is piped to a log-file or -tool; due to buffering:
By default, stdout is buffered (line buffered if connected to a
terminal), and stderr is unbuffered. [1]
Changing stdout to line buffering fixes this.
[1] https://www.gnu.org/software/libc/manual/html_node/Buffering-Concepts.html
Diffstat (limited to 'llmnrd.c')
-rw-r--r-- | llmnrd.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -161,6 +161,8 @@ int main(int argc, char **argv) int llmnrd_sock_rtnl = -1; int nfds; + setlinebuf(stdout); + while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) { switch (c) { case 'd': |