summaryrefslogtreecommitdiffstats
path: root/sys-utils/dmesg.c
diff options
context:
space:
mode:
authorKarel Zak2014-02-06 11:48:40 +0100
committerKarel Zak2014-02-06 11:48:40 +0100
commit3938c08cd56a7c83ea387073c1404d0e864c9fa3 (patch)
treea20f2c4a0e25e1ac296a7bdc53b180399dacfd0f /sys-utils/dmesg.c
parentlosetup: wait for udev (diff)
downloadkernel-qcow2-util-linux-3938c08cd56a7c83ea387073c1404d0e864c9fa3.tar.gz
kernel-qcow2-util-linux-3938c08cd56a7c83ea387073c1404d0e864c9fa3.tar.xz
kernel-qcow2-util-linux-3938c08cd56a7c83ea387073c1404d0e864c9fa3.zip
dmesg: -w output not line-buffered
when writing to e.g. a pipe, output from dmesg -w can come many minutes late due to buffering. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1060925 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/dmesg.c')
-rw-r--r--sys-utils/dmesg.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index ec39612fb..3ed0b1db7 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -1010,6 +1010,8 @@ static int init_kmsg(struct dmesg_control *ctl)
if (!ctl->follow)
mode |= O_NONBLOCK;
+ else
+ setlinebuf(stdout);
ctl->kmsg = open("/dev/kmsg", mode);
if (ctl->kmsg < 0)