36 lines
1.0 KiB
Diff
36 lines
1.0 KiB
Diff
From 34a9b65587a7d704db0344e859511af4a6756c89 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=C3=89rico=20Nogueira?= <erico.erc@gmail.com>
|
|
Date: Fri, 22 Oct 2021 14:28:50 -0300
|
|
Subject: [PATCH] vipw: flush stdout before getting answer.
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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>
|
|
---
|
|
login-utils/vipw.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/login-utils/vipw.c b/login-utils/vipw.c
|
|
index 8e63efde2..f59948a44 100644
|
|
--- a/login-utils/vipw.c
|
|
+++ b/login-utils/vipw.c
|
|
@@ -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);
|
|
--
|
|
2.33.0
|
|
|