vipw: flush stdout before getting answer.

Otherwise the question is displayed only after the user presses Return,
and the program looks like it's hanging.

This happens at least on musl libc.

Reported by @loreb.

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
This commit is contained in:
Érico Nogueira 2021-10-22 14:28:50 -03:00
parent 58e4ee082b
commit 34a9b65587
1 changed files with 1 additions and 0 deletions

View File

@ -353,6 +353,7 @@ int main(int argc, char *argv[])
* which means they can be translated. */
printf(_("Would you like to edit %s now [y/n]? "), orig_file);
fflush(stdout);
if (fgets(response, sizeof(response), stdin) &&
rpmatch(response) == RPMATCH_YES)
edit_file(1);