aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-01-08 01:52:36 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-01-08 01:52:36 +0000
commit69cb1f830e4fd2282ddcbc7ee2bbe30069b9e4cd (patch)
tree49efff28238bbba524974db0512859a310d0b09c /window.c
parent703160b5d6b64e45a684894260693c60b5524d51 (diff)
downloadrtmux-69cb1f830e4fd2282ddcbc7ee2bbe30069b9e4cd.tar.gz
rtmux-69cb1f830e4fd2282ddcbc7ee2bbe30069b9e4cd.tar.bz2
rtmux-69cb1f830e4fd2282ddcbc7ee2bbe30069b9e4cd.zip
Move all calls to fcntl(...O_NONBLOCK) into a function and clear the
flag on the stdio file descriptors before closing them (fixes things like "tmux ls && cat").
Diffstat (limited to 'window.c')
-rw-r--r--window.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/window.c b/window.c
index ebd3976b..f965d27f 100644
--- a/window.c
+++ b/window.c
@@ -563,7 +563,6 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
const char *cwd, struct environ *env, struct termios *tio, char **cause)
{
struct winsize ws;
- int mode;
char *argv0;
const char *ptr;
struct termios tio2;
@@ -637,10 +636,8 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
fatal("execl failed");
}
- if ((mode = fcntl(wp->fd, F_GETFL)) == -1)
- fatal("fcntl failed");
- if (fcntl(wp->fd, F_SETFL, mode|O_NONBLOCK) == -1)
- fatal("fcntl failed");
+ setblocking(wp->fd, 0);
+
wp->event = bufferevent_new(wp->fd,
window_pane_read_callback, NULL, window_pane_error_callback, wp);
bufferevent_enable(wp->event, EV_READ|EV_WRITE);