From b9208b18d5d6f747062fbda0a70c27212711ab0a Mon Sep 17 00:00:00 2001 From: mp Date: Sat, 28 Jul 2001 22:40:10 +0000 Subject: [PATCH] Properly handle wgetch(3) returning ERR. This prevents an abnormal exit when a windows resize event (SIGWINCH) occurs. Reported by: John Doe and others on -stable. Reviewed by: dd MFC after: 1 week --- usr.bin/ee/ee.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/usr.bin/ee/ee.c b/usr.bin/ee/ee.c index 475e9e8863de..effdf14fb915 100644 --- a/usr.bin/ee/ee.c +++ b/usr.bin/ee/ee.c @@ -630,7 +630,7 @@ char *argv[]; doupdate(); in = wgetch(text_win); if (in == -1) - exit(0); + continue; resize_check(); @@ -1877,7 +1877,7 @@ int advance; /* if true, skip leading spaces and tabs */ esc_flag = FALSE; in = wgetch(com_win); if (in == -1) - exit(0); + continue; if (((in == 8) || (in == 127) || (in == KEY_BACKSPACE)) && (g_pos > 0)) { tmp_int = g_horz; @@ -1902,7 +1902,7 @@ int advance; /* if true, skip leading spaces and tabs */ esc_flag = TRUE; in = wgetch(com_win); if (in == -1) - exit(0); + continue; } *nam_str = in; g_pos++; @@ -3382,10 +3382,7 @@ struct menu_entries menu_list[]; wmove(temp_win, (counter + top_offset - off_start), 3); wrefresh(temp_win); - in = wgetch(temp_win); - input = in; - if (input == -1) - exit(0); + input = wgetch(temp_win); if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) || ((input >= '0') && (input <= '9'))) @@ -3628,8 +3625,6 @@ help() wprintw(com_win, press_any_key_msg); wrefresh(com_win); counter = wgetch(com_win); - if (counter == -1) - exit(0); werase(com_win); wmove(com_win, 0, 0); werase(help_win);