EOF handling in read_line_input
Mark Salter
msalter at redhat.com
Tue Sep 7 11:57:23 UTC 2010
I am using busybox 1.17.1 and am seeing a hang in hush when a telnet
session is closed without an explicit exit. In that case, hush gets a
SIGHUP, but hush blocks SIGHUP so that it can be handled synchronously
in check_and_run_traps(). The problem is that read_line_input never
returns so check_and_run_traps never gets the chance to see the SIGHUP.
I had to use the following to get read_line_input to return on EOF. Am
I missing anything here?
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index a9b790c..fe320bf 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2010,6 +2010,9 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
#endif
switch (ic) {
+ case -1:
+ break_out = command_len = -1;
+ break;
case '\n':
case '\r':
vi_case('\n'|VI_CMDMODE_BIT:)
--Mark
More information about the busybox
mailing list