summaryrefslogtreecommitdiffstats
path: root/usr.bin/logger/logger.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2009-10-30 21:54:53 +0000
committermckusick <mckusick@FreeBSD.org>2009-10-30 21:54:53 +0000
commit1f53d347029c3b07dacad99883a9946231b5efce (patch)
tree59f90eee9869de12ba6e96d0e1d70e46def7568f /usr.bin/logger/logger.c
parent514b7768c10c7c81e87b123cbb5abaab67117494 (diff)
downloadFreeBSD-src-1f53d347029c3b07dacad99883a9946231b5efce.zip
FreeBSD-src-1f53d347029c3b07dacad99883a9946231b5efce.tar.gz
When reading input from a file or device (via -f option) set the
input to be in non-buffering mode so that input lines are logged as they occur rather than being saved up until a buffer's worth of input has been logged.
Diffstat (limited to 'usr.bin/logger/logger.c')
-rw-r--r--usr.bin/logger/logger.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c
index 5d9ec4d..9027105 100644
--- a/usr.bin/logger/logger.c
+++ b/usr.bin/logger/logger.c
@@ -114,6 +114,7 @@ main(int argc, char *argv[])
case 'f': /* file to log */
if (freopen(optarg, "r", stdin) == NULL)
err(1, "%s", optarg);
+ setvbuf(stdin, 0, _IONBF, 0);
break;
case 'h': /* hostname to deliver to */
host = optarg;
OpenPOWER on IntegriCloud