mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 06:17:04 +00:00
Sync OpenBSD patchset 775:
Trying to set FD_CLOEXEC on every fd is a lost cause, just use closefrom() before exec.
This commit is contained in:
6
job.c
6
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);
|
||||
|
Reference in New Issue
Block a user