From 9d858f5717cfc261d2ee80efff954acd7b1e5c00 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 5 Sep 2017 19:16:40 +0200 Subject: chat: do not die when HANGUP param is missing. Closes 10016 function old new delta chat_main 1356 1379 +23 Signed-off-by: Denys Vlasenko --- miscutils/chat.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/miscutils/chat.c b/miscutils/chat.c index 1446a040c..2dfe52c4f 100644 --- a/miscutils/chat.c +++ b/miscutils/chat.c @@ -238,10 +238,18 @@ int chat_main(int argc UNUSED_PARAM, char **argv) , *argv ); if (key >= 0) { + bool onoff; // cache directive value char *arg = *++argv; + + if (!arg) { +#if ENABLE_FEATURE_CHAT_TTY_HIFI + tcsetattr(STDIN_FILENO, TCSAFLUSH, &tio0); +#endif + bb_show_usage(); + } // OFF -> 0, anything else -> 1 - bool onoff = (0 != strcmp("OFF", arg)); + onoff = (0 != strcmp("OFF", arg)); // process directive if (DIR_HANGUP == key) { // turn SIGHUP on/off -- cgit v1.2.3