summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpvader <mvader@victronenergy.com>2019-02-03 10:22:49 +0100
committerTobias Klauser <tobias.klauser@gmail.com>2019-02-03 17:32:30 +0100
commitfdf702ec67f8eefbd3ad5bb63f193dce01ef6201 (patch)
tree31576ead6ad88d2bd359dbd64ebaf2311b75407a
parente1b6baa4f71f46b6bd2f9a1e4ffbc2e593d14a48 (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
-rw-r--r--llmnrd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/llmnrd.c b/llmnrd.c
index c9ec6b5..d076484 100644
--- a/llmnrd.c
+++ b/llmnrd.c
@@ -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':