diff options
author | Jim Meyering <jim@meyering.net> | 2004-03-03 22:00:20 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-03-03 22:00:20 +0000 |
commit | 8d0b9f87dd5032e705a16fd7c3875cfb4e32b26e (patch) | |
tree | afa4327719f29e0097a1e64d16e6fdbd51929141 /src | |
parent | 2389b81eefed29cb2117a77397257cf0b936f769 (diff) | |
download | coreutils-8d0b9f87dd5032e705a16fd7c3875cfb4e32b26e.tar.xz |
Include "cloexec.h".
(main): Set the copy of stderr to close on exec.
Diffstat (limited to 'src')
-rw-r--r-- | src/nohup.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nohup.c b/src/nohup.c index d524424ec..c7caa7f01 100644 --- a/src/nohup.c +++ b/src/nohup.c @@ -28,6 +28,7 @@ #include "long-options.h" #include "path-concat.h" #include "quote.h" +#include "cloexec.h" #define PROGRAM_NAME "nohup" @@ -148,6 +149,10 @@ main (int argc, char **argv) the post-failed-execve diagnostic. */ saved_stderr_fd = dup (STDERR_FILENO); + if (set_cloexec_flag (saved_stderr_fd, 1) == -1) + error (NOHUP_FAILURE, errno, + _("failed to set the copy of stderr to close on exec")); + if (dup2 (fd, STDERR_FILENO) == -1) error (NOHUP_FAILURE, errno, _("failed to redirect standard error")); } |