diff options
author | Eric Andersen | 2005-07-18 23:51:27 +0000 |
---|---|---|
committer | Eric Andersen | 2005-07-18 23:51:27 +0000 |
commit | 164a716f964bba247c660bc70149234f95146871 (patch) | |
tree | 95a8a6f75cb2ed1bb07cb6019088db7348ebf4d4 /busybox/coreutils/watch.c | |
parent | 8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373 (diff) | |
download | busybox-164a716f964bba247c660bc70149234f95146871.zip busybox-164a716f964bba247c660bc70149234f95146871.tar.gz |
busybox-1.0.1-rc1.patch
http://busybox.net/lists/busybox/2005-July/014974.html
Diffstat (limited to 'busybox/coreutils/watch.c')
-rw-r--r-- | busybox/coreutils/watch.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/busybox/coreutils/watch.c b/busybox/coreutils/watch.c index f9f4018..31fadfb 100644 --- a/busybox/coreutils/watch.c +++ b/busybox/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,13 +98,11 @@ extern int watch_main(int argc, char **argv) sleep(period); } else if (0 == pid) { //child - close(1); - dup(old_stdout); - if (execvp(*watched_argv, watched_argv)) { - bb_error_msg_and_die("Couldn't run command\n"); - } + dup2(old_stdout, STDOUT_FILENO); + execvp(*watched_argv, watched_argv); + bb_perror_msg_and_die(*watched_argv); } else { - bb_error_msg_and_die("Couldn't vfork\n"); + bb_perror_msg_and_die("vfork"); } } } |