Multiple -o options has the same meaning as having a single option with
all settings in the order of their respective -o options.

Signed-off-by: Kevin Wolf <kw...@redhat.com>
---
 qemu-img.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index e0d19f8..1a98926 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2783,18 +2783,16 @@ static int img_amend(int argc, char **argv)
                 if (is_help_option(optarg)) {
                     options_help = true;
                 } else if (!options) {
-                    options = optarg;
+                    options = g_strdup(optarg);
                 } else {
-                    error_report("-o cannot be used multiple times. Please use 
a "
-                                 "single -o option with comma-separated 
settings "
-                                 "instead.");
-                    return 1;
+                    options = g_strdup_printf("%s,%s", options, optarg);
                 }
                 break;
             case 'f':
                 if (fmt) {
                     error_report("-f may only be specified once");
-                    return 1;
+                    ret = -1;
+                    goto out;
                 }
                 fmt = optarg;
                 break;
@@ -2850,6 +2848,8 @@ out:
     }
     free_option_parameters(create_options);
     free_option_parameters(options_param);
+    g_free(options);
+
     if (ret) {
         return 1;
     }
-- 
1.8.1.4


Reply via email to