Blob Blame History Raw
From eb5eb44f6ef009c68cc8867e3277fa832cad7f10 Mon Sep 17 00:00:00 2001
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Date: Fri, 24 Mar 2017 03:11:10 +0100
Subject: [PATCH 72/75] parted/ui: remove unneccesary information of command
 line

When some command fails, the information still exists in
command_line buffer. When in command mode or interactive mode,
if an interactive exception prompts, the remained information
will be processed as option from user. This will raise some other
information or even unexpected results. So before getting option
input from user, clean the command line buffer.

Example: When the disk label is invalid and user tries to make
	 new partition on the device with command like,
	 mkpart 0 50%. Then parted will raise an exception
	 telling an invalid disk label found and whether to correct it.
	 But at this time 0 as the input of mkpart will be
	 considered as the option input for the exception(yes/no).
	 So one more exception will raised with error information.

Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 parted/ui.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/parted/ui.c b/parted/ui.c
index 505b8ac..c603ed2 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1270,6 +1270,7 @@ command_line_get_ex_opt (const char* prompt, PedExceptionOption options)
         PedExceptionOption    opt;
         char*                 opt_name;
 
+        command_line_flush ();
         for (opt = option_get_next (options, 0); opt;
              opt = option_get_next (options, opt)) {
                 options_strlist = str_list_append_unique (options_strlist,
-- 
2.9.3