diff options
author | Jefferson Delfes <jefferson.delfes@gmail.com> | 2013-12-02 09:42:38 -0400 |
---|---|---|
committer | Jefferson Delfes <jefferson.delfes@gmail.com> | 2013-12-02 12:12:05 -0400 |
commit | f7849c4f452b9cf3f4fea1bbbea4662c1e904cf6 (patch) | |
tree | 735c3343061a98a55365076f1e446ba4b1140de8 | |
parent | 713c8baad42915e32c2d07a4ee6a8b81197cb758 (diff) |
Test for EOF on getchar
If something gone wrong reading char, we need to break main loop.
-rw-r--r-- | btctl.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -2070,6 +2070,12 @@ int main(int argc, char *argv[]) { while (!u.quit) { int c = getchar(); + if (c == EOF) { + rl_printf("error reading input, exiting...\n"); + u.quit = true; + break; + } + /* if we are in consent bonding process, we need only a char */ if (u.prompt_state == SSP_CONSENT_PSTATE) { c = toupper(c); |