When a terminal disappears (and SIGHUP is blocked), attempt to peek into the
input buffer results in an EIO. We should not pretend it's an ordinary line
break, since then the caller would likely try to read another line, resulting
in an endless loop. Insert a READERR instead: readline_internal_char() treats
that as an EOF and communicates to the caller properly.
---
 input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/input.c b/input.c
index f3f6d59..62e14c7 100644
--- a/input.c
+++ b/input.c
@@ -445,7 +445,7 @@ rl_read_key ()
              if ((r = rl_gather_tyi ()) < 0)   /* XXX - EIO */
                {
                  rl_done = 1;
-                 return ('\n');
+                 return (READERR);
                }
              else if (r > 0)                   /* read something */
                continue;
-- 
2.4.3


_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to