[BusyBox-cvs] svn commit: trunk/busybox/coreutils

vapier at busybox.net vapier at busybox.net
Thu Jun 30 03:43:15 UTC 2005


Author: vapier
Date: 2005-06-29 21:43:14 -0600 (Wed, 29 Jun 2005)
New Revision: 10642

Log:
patch by Shaun Jackman to combine dup/close funcs into dup2

Modified:
   trunk/busybox/coreutils/watch.c


Changeset:
Modified: trunk/busybox/coreutils/watch.c
===================================================================
--- trunk/busybox/coreutils/watch.c	2005-06-30 02:26:50 UTC (rev 10641)
+++ trunk/busybox/coreutils/watch.c	2005-06-30 03:43:14 UTC (rev 10642)
@@ -82,7 +82,7 @@
 	header[len] = 0;
 
 	/* thanks to lye, who showed me how to redirect stdin/stdout */
-	old_stdout = dup(1);
+	old_stdout = dup(STDOUT_FILENO);
 
 	while (1) {
 		time(&t);
@@ -98,8 +98,7 @@
 			sleep(period);
 		} else if (0 == pid) {
 			//child
-			close(1);
-			dup(old_stdout);
+			dup2(old_stdout, STDOUT_FILENO);
 			execvp(*watched_argv, watched_argv);
 			bb_perror_msg_and_die(*watched_argv);
 		} else {




More information about the busybox-cvs mailing list