svn commit: trunk/busybox/coreutils

vda at busybox.net vda at busybox.net
Wed Jul 16 07:34:00 UTC 2008


Author: vda
Date: 2008-07-16 00:34:00 -0700 (Wed, 16 Jul 2008)
New Revision: 22841

Log:
tee: fix infinite looping on open error (echo asd | tee "")



Modified:
   trunk/busybox/coreutils/tee.c


Changeset:
Modified: trunk/busybox/coreutils/tee.c
===================================================================
--- trunk/busybox/coreutils/tee.c	2008-07-16 07:22:14 UTC (rev 22840)
+++ trunk/busybox/coreutils/tee.c	2008-07-16 07:34:00 UTC (rev 22841)
@@ -55,12 +55,14 @@
 			*fp = fopen_or_warn(*argv, mode);
 			if (*fp == NULL) {
 				retval = EXIT_FAILURE;
+				argv++;
 				continue;
 			}
 		}
 		*np = *argv++;
  GOT_NEW_FILE:
-		setbuf(*fp++, NULL);	/* tee must not buffer output. */
+		setbuf(*fp, NULL);	/* tee must not buffer output. */
+		fp++;
 		np++;
 	} while (*argv);
 	/* names[0] will be filled later */




More information about the busybox-cvs mailing list