summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-03-04 08:50:50 +0000
committerJim Meyering <jim@meyering.net>2004-03-04 08:50:50 +0000
commit940ffe5e02093f9adf6f21c0324ed54042202347 (patch)
tree28d17475db4d5c3c90ba8b3abc4a45850bd30362 /src
parentb8e698744ed4aeeb73c75565fc8c767a03c0fcc7 (diff)
downloadcoreutils-940ffe5e02093f9adf6f21c0324ed54042202347.tar.xz
(main): Don't invoke set_cloexec_flag with a file descriptor of -1.
Diffstat (limited to 'src')
-rw-r--r--src/nohup.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nohup.c b/src/nohup.c
index c7caa7f01..6c9f54231 100644
--- a/src/nohup.c
+++ b/src/nohup.c
@@ -149,7 +149,8 @@ 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)
+ if (saved_stderr_fd != -1
+ && ! set_cloexec_flag (saved_stderr_fd, true))
error (NOHUP_FAILURE, errno,
_("failed to set the copy of stderr to close on exec"));