summaryrefslogtreecommitdiff
path: root/lib/readline/readline.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/readline/readline.c')
-rw-r--r--lib/readline/readline.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/readline/readline.c b/lib/readline/readline.c
index 5eaaf47..c2b7400 100644
--- a/lib/readline/readline.c
+++ b/lib/readline/readline.c
@@ -49,6 +49,11 @@
#include <stdio.h>
#include "posixjmp.h"
+#include <errno.h>
+
+#if !defined (errno)
+extern int errno;
+#endif /* !errno */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@@ -479,6 +484,20 @@ readline_internal_charloop ()
c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_READCMD);
+ /* look at input.c:rl_getc() for the circumstances under which this will
+ be returned; punt immediately on read error without converting it to
+ a newline. */
+ if (c == READERR)
+ {
+#if defined (READLINE_CALLBACKS)
+ RL_SETSTATE(RL_STATE_DONE);
+ return (rl_done = 1);
+#else
+ eof_found = 1;
+ break;
+#endif
+ }
+
/* EOF typed to a non-blank line is a <NL>. */
if (c == EOF && rl_end)
c = NEWLINE;