qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] Consolidate printing of block driver option


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 1/3] Consolidate printing of block driver options
Date: Mon, 6 Dec 2010 10:37:17 +0000

On Mon, Dec 6, 2010 at 10:20 AM, Jes Sorensen <address@hidden> wrote:
> On 12/06/10 10:32, Stefan Hajnoczi wrote:
>> On Mon, Dec 6, 2010 at 8:17 AM,  <address@hidden> wrote:
>>> @@ -694,6 +721,11 @@ static int img_convert(int argc, char **argv)
>>>
>>>     out_filename = argv[argc - 1];
>>>
>>> +    if (options && !strcmp(options, "?")) {
>>> +        ret = print_block_option_help(out_filename, out_fmt);
>>> +        goto out2;
>>> +    }
>>> +
>>>     if (bs_n > 1 && out_baseimg) {
>>>         error("-B makes no sense when concatenating multiple input images");
>>>         return 1;
>>
>> Why goto out2 and not just return like the bs > 1 && out_baseimg check?
>
> It is cleaner, I'd rather convert the bs_n test to do it too.

"out2" tells me nothing and is just indirection for a return.  At this
point no resources have been acquired and it is simplest to bail out
early.

The segfault on out is fixed by setting up bs_n and bs[] together
instead of doing checks in between (that way we never have bs_n > 0
and bs == NULL).  Or by adding a check for bs != NULL to the out
cleanup code.  Then it would be safe to use out.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]