I don't think it makes much difference whether we use setvbuf(3) or flush
at the end of each line; I went with the latter just because when we're
coloring, each line is made up of several separate chunks.
---
 toys/lsb/dmesg.c | 2 ++
 1 file changed, 2 insertions(+)
From b174bf520e00e0673372e306ba60763a80193881 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Fri, 9 Dec 2016 14:52:36 -0800
Subject: [PATCH] dmesg -w output shouldn't be buffered.

I don't think it makes much difference whether we use setvbuf(3) or flush
at the end of each line; I went with the latter just because when we're
coloring, each line is made up of several separate chunks.
---
 toys/lsb/dmesg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/toys/lsb/dmesg.c b/toys/lsb/dmesg.c
index 45319b6..c361f74 100644
--- a/toys/lsb/dmesg.c
+++ b/toys/lsb/dmesg.c
@@ -150,6 +150,8 @@ void dmesg_main(void)
       color(0);
       xputc('\n');
     }
+
+    if (toys.optflags & FLAG_w) fflush(stdout);
   }
   close(fd);
 }
-- 
2.8.0.rc3.226.g39d4020

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to