summaryrefslogtreecommitdiffstats
path: root/cmd-pipe-pane.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 /cmd-pipe-pane.c
parent703160b5d6b64e45a684894260693c60b5524d51 (diff)
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 'cmd-pipe-pane.c')
-rw-r--r--cmd-pipe-pane.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 6284bf37..d0e47541 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -53,7 +53,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
struct client *c;
struct window_pane *wp;
char *command;
- int old_fd, pipe_fd[2], null_fd, mode;
+ int old_fd, pipe_fd[2], null_fd;
if ((c = cmd_find_client(ctx, NULL)) == NULL)
return (-1);
@@ -127,10 +127,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
NULL, NULL, cmd_pipe_pane_error_callback, wp);
bufferevent_enable(wp->pipe_event, EV_WRITE);
- if ((mode = fcntl(wp->pipe_fd, F_GETFL)) == -1)
- fatal("fcntl failed");
- if (fcntl(wp->pipe_fd, F_SETFL, mode|O_NONBLOCK) == -1)
- fatal("fcntl failed");
+ setblocking(wp->pipe_fd, 0);
return (0);
}
}