summaryrefslogtreecommitdiff
path: root/builtins/read.def
diff options
context:
space:
mode:
Diffstat (limited to 'builtins/read.def')
-rw-r--r--builtins/read.def13
1 files changed, 11 insertions, 2 deletions
diff --git a/builtins/read.def b/builtins/read.def
index 64a4a11a..e1e63541 100644
--- a/builtins/read.def
+++ b/builtins/read.def
@@ -46,6 +46,8 @@ $END
# include <unistd.h>
#endif
+#include <errno.h>
+
#include "../shell.h"
#include "common.h"
#include "bashgetopt.h"
@@ -55,6 +57,10 @@ $END
#include <readline/readline.h>
#endif
+#if !defined(errno)
+extern int errno;
+#endif
+
#define issep(c) (strchr (ifs_chars, (c)))
extern int interrupt_immediately;
@@ -180,8 +186,11 @@ read_builtin (list)
c = rlbuf[rlind++];
}
else
-#endif
- if (read (0, &c, 1) != 1)
+#endif
+
+ while (((retval = read (0, &c, 1)) < 0) && errno == EINTR)
+ ;
+ if (retval <= 0)
{
eof = 1;
break;