[parted-devel] [PATCH] parted/ui: remove unneccesary information of command line
Wang Dong
dongdwdw at linux.vnet.ibm.com
Fri Mar 24 02:11:10 UTC 2017
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 at linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner at linux.vnet.ibm.com>
---
parted/ui.c | 1 +
1 file changed, 1 insertion(+)
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,
--
2.8.4
More information about the parted-devel
mailing list