[BusyBox] [patch] Make busybox "tee" usable in block I/O mode.

Rob Landley rob at landley.net
Fri May 21 03:37:54 UTC 2004


Run this test, against both busybox and a non-busybox version of "tee".

while true; do i=$[$i+1]; echo "hello $i"; sleep 1; done | ./busybox tee

Now run the busybox one again with the following small patch applied:

--- /home/landley/pending/cvs/busybox/coreutils/tee.c	2004-03-15 
02:28:21.000000000 -0600
+++ busybox/coreutils/tee.c	2004-05-20 22:29:51.124879400 -0500
@@ -78,7 +78,7 @@
 	*p = NULL;				/* Store the sentinal value. */
 
 #ifdef CONFIG_FEATURE_TEE_USE_BLOCK_IO
-	while ((c = fread(buf, 1, BUFSIZ, stdin)) != 0) {
+	while ((c = read(0, buf, BUFSIZ)) != 0) {
 		for (p=files ; *p ; p++) {
 			fwrite(buf, 1, c, *p);
 		}





More information about the busybox mailing list