summary refs log tree commit diff
path: root/src/miscbltin.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/miscbltin.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/miscbltin.c b/src/miscbltin.c
index 046f2f2..5ab1648 100644
--- a/src/miscbltin.c
+++ b/src/miscbltin.c
@@ -57,6 +57,7 @@
 #include "main.h"
 #include "expand.h"
 #include "parser.h"
+#include "trap.h"
 
 #undef rflag
 
@@ -158,9 +159,16 @@ readcmd(int argc, char **argv)
 	backslash = 0;
 	STARTSTACKSTR(p);
 	for (;;) {
-		if (read(0, &c, 1) != 1) {
-			status = 1;
+		switch (read(0, &c, 1)) {
+		case 1:
 			break;
+		default:
+			if (errno == EINTR && !pendingsigs)
+				continue;
+				/* fall through */
+		case 0:
+			status = 1;
+			goto out;
 		}
 		if (c == '\0')
 			continue;
@@ -181,6 +189,7 @@ put:
 resetbs:
 		backslash = 0;
 	}
+out:
 	STACKSTRNUL(p);
 	readcmd_handle_line(stackblock(), ap, p + 1 - (char *)stackblock());
 	return status;