bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] [PATCH] rl_read_key: don't inject a line break in case of


From: Lubomir Rintel
Subject: [Bug-readline] [PATCH] rl_read_key: don't inject a line break in case of an I/O error
Date: Thu, 20 Aug 2015 17:35:35 +0200

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]