about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2023-07-26 19:54:30 -0700
committerBart Schaefer <schaefer@zsh.org>2023-07-26 19:54:30 -0700
commitaa85564319f4d511fae04a3cdf7a0b1fba1f67fe (patch)
tree0a6050cc4faf874d17753ee2917f76f831052d6b /Src/builtin.c
parent301412c0e8f413cacf601f3a8de3f43098fd6179 (diff)
downloadzsh-aa85564319f4d511fae04a3cdf7a0b1fba1f67fe.tar.gz
zsh-aa85564319f4d511fae04a3cdf7a0b1fba1f67fe.tar.xz
zsh-aa85564319f4d511fae04a3cdf7a0b1fba1f67fe.zip
51969: read -d and -s should not reset terminal state when stdin is redirected
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 669a47092..1568cf44c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -6483,7 +6483,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
     } else
 	readfd = izle = 0;
 
-    if (OPT_ISSET(ops,'s') && SHTTY != -1) {
+    if (OPT_ISSET(ops,'s') && SHTTY == readfd) {
 	struct ttyinfo ti;
 	gettyinfo(&ti);
 	saveti = ti;
@@ -6531,7 +6531,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
         delim = (unsigned char) ((delimstr[0] == Meta) ?
 			delimstr[1] ^ 32 : delimstr[0]);
 #endif
-	if (SHTTY != -1) {
+	if (SHTTY == readfd) {
 	    struct ttyinfo ti;
 	    gettyinfo(&ti);
 	    if (! resettty) {
@@ -6691,7 +6691,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
 	    /* dispose of result appropriately, etc. */
 	    if (isem)
 		while (val > 0 && read(SHTTY, &d, 1) == 1 && d != '\n');
-	    else {
+	    else if (resettty) {
 		settyinfo(&shttyinfo);
 		resettty = 0;
 	    }