Skip to contentSkip to conversation

fdisk: stop buffering welcome message

PATCH In review Davidlohr Bueso 2 participants 2 messages May 27, 2012 – Jun 6, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 fdisk: stop buffering welcome message

From: Davidlohr Bueso <[email protected]>

Recently, commit 0a86755fe8af1da510d2eca43bdfcd70af098c19 directed the welcome message output from stderr to stdout breaking regression tests. Correct this by flushing stdout and stop buffering the output - a trivial function is created as well.

---
 fdisk/fdisk.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
fdisk/fdisk.c +10 -3
index 12706c2..084253d 100644
@@ -1984,6 +1984,15 @@ unknown_command(int c) {
 	printf(_("%c: unknown command\n"), c);
 }
 
+static void print_welcome(void)
+{
+	printf(_("Welcome to fdisk (%s).\n\n"
+		 "Changes will remain in memory only, until you decide to write them.\n"
+		 "Be careful before using the write command.\n\n"), PACKAGE_STRING);
+
+	fflush(stdout);
+}
+
 static void command_prompt(void)
 {
 	int c;
@@ -2211,9 +2220,7 @@ int main(int argc, char **argv)
 	else
 		usage(stderr);
 
-	printf(_("Welcome to fdisk (%s).\n\n"
-		"Changes will remain in memory only, until you decide to write them.\n"
-		"Be careful before using the write command.\n\n"), PACKAGE_STRING);
+	print_welcome();
 
 	gpt_warning(cxt->dev_path);
 	get_boot(0);
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw
Quoted 2 lines · Davidlohr Bueso
 fdisk/fdisk.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

All 7 patches applied. Thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com