]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
dmesg: -w output not line-buffered
authorKarel Zak <kzak@redhat.com>
Thu, 6 Feb 2014 10:48:40 +0000 (11:48 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 6 Feb 2014 10:48:40 +0000 (11:48 +0100)
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>
sys-utils/dmesg.c

index ec39612fbcada0078ac184c78583a9a12e73120c..3ed0b1db7576d33a86139954f6696f7fb7a1c998 100644 (file)
@@ -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)