Do not allow pipe-pane on dead panes, from Anindya Mukherjee, GitHub issue

3174.
This commit is contained in:
Nicholas Marriott 2022-05-02 10:46:11 +01:00
parent 5ed64657d8
commit 3b7dae9a53

View File

@ -67,6 +67,12 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
struct format_tree *ft; struct format_tree *ft;
sigset_t set, oldset; 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. */ /* Destroy the old pipe. */
old_fd = wp->pipe_fd; old_fd = wp->pipe_fd;
if (wp->pipe_fd != -1) { if (wp->pipe_fd != -1) {