From ac6d18e54ca537f9a26e5ca65e1b1c0faf88d7ad Mon Sep 17 00:00:00 2001 From: vapier Date: Thu, 30 Jun 2005 03:43:14 +0000 Subject: patch by Shaun Jackman to combine dup/close funcs into dup2 git-svn-id: svn://busybox.net/trunk/busybox@10642 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- coreutils/watch.c | 5 ++--- 1 file 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) 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 @@ extern int watch_main(int argc, char **argv) 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 { -- cgit v1.2.3-55-g6feb