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:
Tiago Cunha
2010-10-24 00:45:57 +00:00
parent 5fb4f8c1fa
commit d4b58c71a2
8 changed files with 957 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.137 2010-09-07 19:32:58 nicm Exp $ */
/* $Id: window.c,v 1.138 2010-10-24 00:45:57 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -570,6 +570,8 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
if (tcsetattr(STDIN_FILENO, TCSANOW, &tio2) != 0)
fatal("tcgetattr failed");
closefrom(STDERR_FILENO + 1);
environ_push(env);
clear_signals(1);
@ -600,8 +602,6 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
fatal("fcntl failed");
if (fcntl(wp->fd, F_SETFL, mode|O_NONBLOCK) == -1)
fatal("fcntl failed");
if (fcntl(wp->fd, F_SETFD, FD_CLOEXEC) == -1)
fatal("fcntl failed");
wp->event = bufferevent_new(wp->fd,
window_pane_read_callback, NULL, window_pane_error_callback, wp);
bufferevent_enable(wp->event, EV_READ|EV_WRITE);