about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2023-11-18 16:22:24 -0800
committerBart Schaefer <schaefer@zsh.org>2023-11-18 16:22:24 -0800
commitfcf080ab578de00c799eb287ef8bdc201c313fee (patch)
tree8f26ba2649efda17884cc0772e4eeb4234076a76
parente32da8611197a56482ac3da7a85fc9e1d02e7b98 (diff)
downloadzsh-fcf080ab578de00c799eb287ef8bdc201c313fee.tar.gz
zsh-fcf080ab578de00c799eb287ef8bdc201c313fee.tar.xz
zsh-fcf080ab578de00c799eb287ef8bdc201c313fee.zip
52313: Src/exec.c: multios are not interactive and check for write errors.
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 09b854e54..feeae6068 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-11-18  Bart Schaefer  <schaefer@zsh.org>
+
+	* 52313: Src/exec.c: subshells implementing multio reads/writes
+	are not interactive and should check for write errors.
+
 2023-11-17  Oliver Kiddle  <opk@zsh.org>
 
 	* 52307: Completion/Linux/Command/_selinux,
diff --git a/Src/exec.c b/Src/exec.c
index 97823760f..7d8135266 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2290,6 +2290,8 @@ closemn(struct multio **mfds, int fd, int type)
 	    return;
 	}
 	/* pid == 0 */
+	opts[INTERACTIVE] = 0;
+	dont_queue_signals();
 	child_unblock();
 	closeallelse(mn);
 	if (mn->rflag) {
@@ -2302,7 +2304,8 @@ closemn(struct multio **mfds, int fd, int type)
 			break;
 		}
 		for (i = 0; i < mn->ct; i++)
-		    write_loop(mn->fds[i], buf, len);
+		    if (write_loop(mn->fds[i], buf, len) < 0)
+			break;
 	    }
 	} else {
 	    /* cat process */
@@ -2314,7 +2317,8 @@ closemn(struct multio **mfds, int fd, int type)
 			else
 			    break;
 		    }
-		    write_loop(mn->pipe, buf, len);
+		    if (write_loop(mn->pipe, buf, len) < 0)
+			break;
 		}
 	}
 	_exit(0);