From 0a08200bd5664d1849e477f7f776ab4d13bb8422 Mon Sep 17 00:00:00 2001
From: Lorenzo Beretta <vc.net.loreb@gmail.com>
Date: Mon, 25 Oct 2021 15:28:02 +0200
Subject: [PATCH] chsh: fflush stdout before reading from stdin

Same problem as described in https://github.com/karelzak/util-linux/pull/1481

Signed-off-by: Lorenzo Beretta <vc.net.loreb@gmail.com>
---
 login-utils/chsh.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/login-utils/chsh.c b/login-utils/chsh.c
index 17cc9f1..63b8b29 100644
--- a/login-utils/chsh.c
+++ b/login-utils/chsh.c
@@ -210,6 +210,7 @@ static char *ask_new_shell(char *question, char *oldshell)
 	if ((ans = readline(" ")) == NULL)
 #else
 	putchar(' ');
+	fflush(stdout);
 	if (getline(&ans, &dummy, stdin) < 0)
 #endif
 		return NULL;
-- 
2.27.0

