aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-06-30 03:43:14 +0000
committerMike Frysinger <vapier@gentoo.org>2005-06-30 03:43:14 +0000
commita87bb6080925177b0c09416a6b4e213bd9450042 (patch)
treeb1b59f8ee0addfaddf28090212e9ce6058bb7bb6
parent8804c6a3b79eb1b324ecd07d2992e6fcce0d7029 (diff)
downloadbusybox-w32-a87bb6080925177b0c09416a6b4e213bd9450042.tar.gz
busybox-w32-a87bb6080925177b0c09416a6b4e213bd9450042.tar.bz2
busybox-w32-a87bb6080925177b0c09416a6b4e213bd9450042.zip
patch by Shaun Jackman to combine dup/close funcs into dup2
-rw-r--r--coreutils/watch.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/coreutils/watch.c b/coreutils/watch.c
index 8a6a019bc..31fadfb85 100644
--- a/coreutils/watch.c
+++ b/coreutils/watch.c
@@ -82,7 +82,7 @@ extern int watch_main(int argc, char **argv)
82 header[len] = 0; 82 header[len] = 0;
83 83
84 /* thanks to lye, who showed me how to redirect stdin/stdout */ 84 /* thanks to lye, who showed me how to redirect stdin/stdout */
85 old_stdout = dup(1); 85 old_stdout = dup(STDOUT_FILENO);
86 86
87 while (1) { 87 while (1) {
88 time(&t); 88 time(&t);
@@ -98,8 +98,7 @@ extern int watch_main(int argc, char **argv)
98 sleep(period); 98 sleep(period);
99 } else if (0 == pid) { 99 } else if (0 == pid) {
100 //child 100 //child
101 close(1); 101 dup2(old_stdout, STDOUT_FILENO);
102 dup(old_stdout);
103 execvp(*watched_argv, watched_argv); 102 execvp(*watched_argv, watched_argv);
104 bb_perror_msg_and_die(*watched_argv); 103 bb_perror_msg_and_die(*watched_argv);
105 } else { 104 } else {