]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
line: keep stdin unbuiffered
authorKarel Zak <kzak@redhat.com>
Wed, 2 Dec 2015 14:01:23 +0000 (15:01 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 2 Dec 2015 14:01:23 +0000 (15:01 +0100)
 $ printf 'a\nb\n' | echo $(./line) :: $(./line)

broken version:

 a ::

fixed version:

 a :: b

Addresses: https://github.com/karelzak/util-linux/issues/236
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/line.c

index 9384b5c6c1f26a2986353f5938f0b4006ddfe456..7bee6d2fdc981c576108d3d52c4f7c87011fb319 100644 (file)
@@ -67,6 +67,7 @@ int main(int argc, char **argv)
                        usage(stderr);
                }
 
+       setvbuf(stdin, NULL, _IONBF, 0);
        for (;;) {
                c = getwchar();
                if (c == WEOF) {