diff options
-rw-r--r-- | src/nohup.c | 3 |
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")); |