about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-04-11 16:34:21 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-04-11 16:34:21 +0000
commit35ddd9c4bae1956932dc45b4af48391ac71da0a2 (patch)
tree2097a461616752935f21544223a6277ce8e0fcb9 /Src/builtin.c
parentf2ea8831e16a0238908ec116c93df3676e52ae4f (diff)
downloadzsh-35ddd9c4bae1956932dc45b4af48391ac71da0a2.tar.gz
zsh-35ddd9c4bae1956932dc45b4af48391ac71da0a2.tar.xz
zsh-35ddd9c4bae1956932dc45b4af48391ac71da0a2.zip
users/15953: handle EINTR when using read -k or -q with -u or -p
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index cda5e68cb..127d58bdb 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5291,9 +5291,16 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
 		    *bptr = readchar;
 		    val = 1;
 		    readchar = -1;
-		} else if ((val = read(readfd, bptr, nchars)) <= 0) {
-		    eof = 1;
-		    break;
+		} else {
+		    while ((val = read(readfd, bptr, nchars)) < 0) {
+			if (errno != EINTR ||
+			    errflag || retflag || breaks || contflag)
+			    break;
+		    }
+		    if (val <= 0) {
+			eof = 1;
+			break;
+		    }
 		}
 
 #ifdef MULTIBYTE_SUPPORT