From 940ffe5e02093f9adf6f21c0324ed54042202347 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 4 Mar 2004 08:50:50 +0000 Subject: [PATCH] (main): Don't invoke set_cloexec_flag with a file descriptor of -1. --- src/nohup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nohup.c b/src/nohup.c index c7caa7f01b..6c9f542310 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")); -- 2.47.2