summaryrefslogtreecommitdiff
path: root/parted
diff options
context:
space:
mode:
authorWang Dong <dongdwdw@linux.vnet.ibm.com>2017-03-24 03:11:10 +0100
committerBrian C. Lane <bcl@redhat.com>2017-05-01 15:05:06 -0700
commit0b7946a095f307e427b81795cbc96028ee179b91 (patch)
treeddbb5cb1399f339b86185e6d51952cbfbf8e90d5 /parted
parentd7a2ff17b15842bf9a3de65ca1ba577bdf568e79 (diff)
downloadparted-0b7946a095f307e427b81795cbc96028ee179b91.tar.gz
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>
Diffstat (limited to 'parted')
-rw-r--r--parted/ui.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/parted/ui.c b/parted/ui.c
index af0539c..752860b 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1288,6 +1288,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,