summaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-03-22 00:25:05 +0100
committerGravatar Nikias Bassen2019-03-22 00:25:05 +0100
commite0cef46e9c0fe6f4d45ac19a2ddaa74a33a5570e (patch)
treed83c3f252cc4e6a45081be1116a867cbd1e3d390 /src/common.c
parent8a882038b2b1e022fbd19eaf8bea51006a373c06 (diff)
downloadidevicerestore-e0cef46e9c0fe6f4d45ac19a2ddaa74a33a5570e.tar.gz
idevicerestore-e0cef46e9c0fe6f4d45ac19a2ddaa74a33a5570e.tar.bz2
Make sure user input can be cancelled properly
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c
index d4b7c8d..79dc123 100644
--- a/src/common.c
+++ b/src/common.c
@@ -527,7 +527,7 @@ void get_user_input(char *buf, int maxlen, int secure)
int len = 0;
int c;
- while ((c = my_getch())) {
+ while ((c = my_getch()) > 0) {
if ((c == '\r') || (c == '\n')) {
break;
} else if (isprint(c)) {
@@ -541,6 +541,9 @@ void get_user_input(char *buf, int maxlen, int secure)
}
}
}
+ if (c < 0) {
+ len = 0;
+ }
fputs("\n", stdout);
buf[len] = 0;
}