aboutsummaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-10-24 00:45:57 +0000
committerTiago Cunha <tcunha@gmx.com>2010-10-24 00:45:57 +0000
commitd4b58c71a21b1f380612eb0e45b312e4c91e2a95 (patch)
tree3250dd46942f127d5faf97e8a5bfc196f54a6dbc /job.c
parent5fb4f8c1fa3e2a21be846f4fe13c4f6919ff54b2 (diff)
downloadrtmux-d4b58c71a21b1f380612eb0e45b312e4c91e2a95.tar.gz
rtmux-d4b58c71a21b1f380612eb0e45b312e4c91e2a95.tar.bz2
rtmux-d4b58c71a21b1f380612eb0e45b312e4c91e2a95.zip
Sync OpenBSD patchset 775:
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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/job.c b/job.c
index 63856a16..d22df99a 100644
--- a/job.c
+++ b/job.c
@@ -1,4 +1,4 @@
-/* $Id: job.c,v 1.18 2010-08-29 14:42:11 tcunha Exp $ */
+/* $Id: job.c,v 1.19 2010-10-24 00:45:57 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -168,6 +168,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 */
@@ -178,8 +180,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);