diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-09 17:30:55 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-09 17:30:55 +0200 |
| commit | 831756bac440ce5f582305a81fd2b842eb255fc3 (patch) | |
| tree | 00bb1764d6d184a8c821dfb1857b0901e8323e75 | |
| parent | 12e154f0cf4dba7bc508356649f8d57ec1dbef37 (diff) | |
| download | busybox-w32-831756bac440ce5f582305a81fd2b842eb255fc3.tar.gz busybox-w32-831756bac440ce5f582305a81fd2b842eb255fc3.tar.bz2 busybox-w32-831756bac440ce5f582305a81fd2b842eb255fc3.zip | |
unzip: fflush stdout before reading interative y/n answer from stdin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | archival/unzip.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/archival/unzip.c b/archival/unzip.c index 4fa729326..4cc98cdb2 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
| @@ -235,7 +235,7 @@ static void unzip_create_leading_dirs(const char *fn) | |||
| 235 | /* Create all leading directories */ | 235 | /* Create all leading directories */ |
| 236 | char *name = xstrdup(fn); | 236 | char *name = xstrdup(fn); |
| 237 | if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) { | 237 | if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) { |
| 238 | bb_error_msg_and_die("exiting"); /* bb_make_directory is noisy */ | 238 | xfunc_die(); /* bb_make_directory is noisy */ |
| 239 | } | 239 | } |
| 240 | free(name); | 240 | free(name); |
| 241 | } | 241 | } |
| @@ -595,7 +595,7 @@ int unzip_main(int argc, char **argv) | |||
| 595 | } | 595 | } |
| 596 | unzip_create_leading_dirs(dst_fn); | 596 | unzip_create_leading_dirs(dst_fn); |
| 597 | if (bb_make_directory(dst_fn, dir_mode, 0)) { | 597 | if (bb_make_directory(dst_fn, dir_mode, 0)) { |
| 598 | bb_error_msg_and_die("exiting"); | 598 | xfunc_die(); |
| 599 | } | 599 | } |
| 600 | } else { | 600 | } else { |
| 601 | if (!S_ISDIR(stat_buf.st_mode)) { | 601 | if (!S_ISDIR(stat_buf.st_mode)) { |
| @@ -619,6 +619,7 @@ int unzip_main(int argc, char **argv) | |||
| 619 | i = 'y'; | 619 | i = 'y'; |
| 620 | } else { | 620 | } else { |
| 621 | printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn); | 621 | printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn); |
| 622 | fflush_all(); | ||
| 622 | if (!fgets(key_buf, sizeof(key_buf), stdin)) { | 623 | if (!fgets(key_buf, sizeof(key_buf), stdin)) { |
| 623 | bb_perror_msg_and_die("can't read input"); | 624 | bb_perror_msg_and_die("can't read input"); |
| 624 | } | 625 | } |
