summaryrefslogtreecommitdiffstats
path: root/job.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-10-16 08:31:55 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-10-16 08:31:55 +0000
commitf56b4ec2ffa6d5667a3bd86040a1c771c1de33a5 (patch)
treea06294130e18067eca755eb7e91ad6faa548e55c /job.c
parent6c42f1a89e16d69d5fe24bb8b3f6b37148cfa308 (diff)
Trying to set FD_CLOEXEC on every fd is a lost cause, just use
closefrom() before exec.
Diffstat (limited to 'job.c')
-rw-r--r--job.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/job.c b/job.c
index e0dc99ef..ef4066e5 100644
--- a/job.c
+++ b/job.c
@@ -169,6 +169,8 @@ job_run(struct job *job)
if (nullfd != STDIN_FILENO && nullfd != STDERR_FILENO)
close(nullfd);
+ closefrom(STDERR_FILENO + 1);
+
execl(_PATH_BSHELL, "sh", "-c", job->cmd, (char *) NULL);
fatal("execl failed");
default: /* parent */
@@ -179,8 +181,6 @@ job_run(struct job *job)
fatal("fcntl failed");
if (fcntl(job->fd, F_SETFL, mode|O_NONBLOCK) == -1)
fatal("fcntl failed");
- if (fcntl(job->fd, F_SETFD, FD_CLOEXEC) == -1)
- fatal("fcntl failed");
if (job->event != NULL)
bufferevent_free(job->event);