summaryrefslogtreecommitdiffstats
path: root/cmd-pipe-pane.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 /cmd-pipe-pane.c
parent6b19621112c2fccdcde88f864291ef0939820b0d (diff)
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 'cmd-pipe-pane.c')
-rw-r--r--cmd-pipe-pane.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 671902c5..dcaa34ac 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-pipe-pane.c,v 1.16 2011-01-07 14:45:34 tcunha Exp $ */
+/* $Id: cmd-pipe-pane.c,v 1.17 2011-01-21 23:44:13 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -52,7 +52,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);
@@ -126,10 +126,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);
}
}