aboutsummaryrefslogtreecommitdiff
path: root/cmd-pipe-pane.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-pipe-pane.c')
-rw-r--r--cmd-pipe-pane.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 20318492..0fa656ce 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -67,6 +67,12 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
struct format_tree *ft;
sigset_t set, oldset;
+ /* Do nothing if pane is dead. */
+ if (wp->fd == -1 || (wp->flags & PANE_EXITED)) {
+ cmdq_error(item, "target pane has exited");
+ return (CMD_RETURN_ERROR);
+ }
+
/* Destroy the old pipe. */
old_fd = wp->pipe_fd;
if (wp->pipe_fd != -1) {
@@ -130,7 +136,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
sigprocmask(SIG_SETMASK, &oldset, NULL);
close(pipe_fd[0]);
- null_fd = open(_PATH_DEVNULL, O_WRONLY, 0);
+ null_fd = open(_PATH_DEVNULL, O_WRONLY);
if (out) {
if (dup2(pipe_fd[1], STDIN_FILENO) == -1)
_exit(1);