diff mbox

[for-2.10,1/3] qemu-img/convert: Always set ret < 0 on error

Message ID 20170413203401.3213-2-mreitz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Max Reitz April 13, 2017, 8:33 p.m. UTC
Otherwise the qemu-img process will exit with EXIT_SUCCESS instead of
EXIT_FAILURE.

Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 qemu-img.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Eric Blake April 13, 2017, 9:10 p.m. UTC | #1
On 04/13/2017 03:33 PM, Max Reitz wrote:
> Otherwise the qemu-img process will exit with EXIT_SUCCESS instead of
> EXIT_FAILURE.
> 
> Cc: qemu-stable <qemu-stable@nongnu.org>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  qemu-img.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 37c2894678..f2809e1ab4 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -2069,6 +2069,7 @@ static int img_convert(int argc, char **argv)
>              opts = qemu_opts_parse_noisily(&qemu_object_opts,
>                                             optarg, true);
>              if (!opts) {
> +                ret = -1;
>                  goto fail_getopt;
>              }
>              break;
> @@ -2081,6 +2082,7 @@ static int img_convert(int argc, char **argv)
>      if (qemu_opts_foreach(&qemu_object_opts,
>                            user_creatable_add_opts_foreach,
>                            NULL, NULL)) {
> +        ret = -1;
>          goto fail_getopt;
>      }
>  
>
Philippe Mathieu-Daudé April 14, 2017, 3:27 p.m. UTC | #2
On 04/13/2017 05:33 PM, Max Reitz wrote:
> Otherwise the qemu-img process will exit with EXIT_SUCCESS instead of
> EXIT_FAILURE.
>
> Cc: qemu-stable <qemu-stable@nongnu.org>
> Signed-off-by: Max Reitz <mreitz@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  qemu-img.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index 37c2894678..f2809e1ab4 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -2069,6 +2069,7 @@ static int img_convert(int argc, char **argv)
>              opts = qemu_opts_parse_noisily(&qemu_object_opts,
>                                             optarg, true);
>              if (!opts) {
> +                ret = -1;
>                  goto fail_getopt;
>              }
>              break;
> @@ -2081,6 +2082,7 @@ static int img_convert(int argc, char **argv)
>      if (qemu_opts_foreach(&qemu_object_opts,
>                            user_creatable_add_opts_foreach,
>                            NULL, NULL)) {
> +        ret = -1;
>          goto fail_getopt;
>      }
>
>
diff mbox

Patch

diff --git a/qemu-img.c b/qemu-img.c
index 37c2894678..f2809e1ab4 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2069,6 +2069,7 @@  static int img_convert(int argc, char **argv)
             opts = qemu_opts_parse_noisily(&qemu_object_opts,
                                            optarg, true);
             if (!opts) {
+                ret = -1;
                 goto fail_getopt;
             }
             break;
@@ -2081,6 +2082,7 @@  static int img_convert(int argc, char **argv)
     if (qemu_opts_foreach(&qemu_object_opts,
                           user_creatable_add_opts_foreach,
                           NULL, NULL)) {
+        ret = -1;
         goto fail_getopt;
     }