summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-02-10 08:50:41 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-10 09:34:05 +1000
commit3cc9bd9d21120a5b16091734db33cd84831c7f38 (patch)
tree7e2aa2e4edfb78ef99f5071e678ade8567ea4f0e
parentae6d48ceb70d0204c6ab981034c2ebc417da3c1a (diff)
When piping into a file, don't buffer.
Turn off buffering when piping the output into a file to stop ppl sending me empty logs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--evtest.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/evtest.c b/evtest.c
index a68b900..8671c07 100644
--- a/evtest.c
+++ b/evtest.c
@@ -637,6 +637,9 @@ int main (int argc, char **argv)
free(filename);
+ if (!isatty(fileno(stdout)))
+ setbuf(stdout, NULL);
+
if (print_device_info(fd))
return 1;
@@ -653,6 +656,5 @@ int main (int argc, char **argv)
printf("***********************************************\n");
}
-
return print_events(fd);
}