Blame SOURCES/0072-parted-ui-remove-unneccesary-information-of-command-.patch

0cb0b9
From eb5eb44f6ef009c68cc8867e3277fa832cad7f10 Mon Sep 17 00:00:00 2001
0cb0b9
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
0cb0b9
Date: Fri, 24 Mar 2017 03:11:10 +0100
0cb0b9
Subject: [PATCH 72/75] parted/ui: remove unneccesary information of command
0cb0b9
 line
0cb0b9
0cb0b9
When some command fails, the information still exists in
0cb0b9
command_line buffer. When in command mode or interactive mode,
0cb0b9
if an interactive exception prompts, the remained information
0cb0b9
will be processed as option from user. This will raise some other
0cb0b9
information or even unexpected results. So before getting option
0cb0b9
input from user, clean the command line buffer.
0cb0b9
0cb0b9
Example: When the disk label is invalid and user tries to make
0cb0b9
	 new partition on the device with command like,
0cb0b9
	 mkpart 0 50%. Then parted will raise an exception
0cb0b9
	 telling an invalid disk label found and whether to correct it.
0cb0b9
	 But at this time 0 as the input of mkpart will be
0cb0b9
	 considered as the option input for the exception(yes/no).
0cb0b9
	 So one more exception will raised with error information.
0cb0b9
0cb0b9
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
0cb0b9
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
0cb0b9
---
0cb0b9
 parted/ui.c | 1 +
0cb0b9
 1 file changed, 1 insertion(+)
0cb0b9
0cb0b9
diff --git a/parted/ui.c b/parted/ui.c
0cb0b9
index 505b8ac..c603ed2 100644
0cb0b9
--- a/parted/ui.c
0cb0b9
+++ b/parted/ui.c
0cb0b9
@@ -1270,6 +1270,7 @@ command_line_get_ex_opt (const char* prompt, PedExceptionOption options)
0cb0b9
         PedExceptionOption    opt;
0cb0b9
         char*                 opt_name;
0cb0b9
 
0cb0b9
+        command_line_flush ();
0cb0b9
         for (opt = option_get_next (options, 0); opt;
0cb0b9
              opt = option_get_next (options, opt)) {
0cb0b9
                 options_strlist = str_list_append_unique (options_strlist,
0cb0b9
-- 
0cb0b9
2.9.3
0cb0b9