aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-01-21 23:44:13 +0000
committerTiago Cunha <tcunha@gmx.com>2011-01-21 23:44:13 +0000
commit492e3aa4373f0f20a8685cfb3591a9730bb0454a (patch)
tree3f11c4b5b3b68706442324e1be636c07e25d3db5 /window.c
parent6b19621112c2fccdcde88f864291ef0939820b0d (diff)
downloadrtmux-492e3aa4373f0f20a8685cfb3591a9730bb0454a.tar.gz
rtmux-492e3aa4373f0f20a8685cfb3591a9730bb0454a.tar.bz2
rtmux-492e3aa4373f0f20a8685cfb3591a9730bb0454a.zip
Sync OpenBSD patchset 834:
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.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/window.c b/window.c
index 0fdc1171..027635e6 100644
--- a/window.c
+++ b/window.c
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.143 2011-01-07 16:55:40 tcunha Exp $ */
+/* $Id: window.c,v 1.144 2011-01-21 23:44:13 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -560,7 +560,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;
@@ -634,10 +633,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);