[libvirt] [PATCH v3 1/2] vshCommandOptString returns -1 if option is empty and not VSH_OFLAG_EMPTY_OK
Eric Blake
eblake at redhat.com
Fri Jul 15 17:39:56 UTC 2011
On 07/15/2011 09:45 AM, Eric Blake wrote:
> On 07/15/2011 01:06 AM, Hu Tao wrote:
>> Pointed out by Eric. Thanks.
>> ---
>> tools/virsh.c | 9 +++++++--
>> 1 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/virsh.c b/tools/virsh.c
>> index b7cea58..b43af70 100644
>> --- a/tools/virsh.c
>> +++ b/tools/virsh.c
>> @@ -12375,8 +12375,13 @@ vshCommandOptString(const vshCmd *cmd, const char *name, const char **value)
>> vshError(NULL, _("Missing required option '%s'"), name);
>> ret = -1;
>> } else {
>> - /* Treat "--option ''" as if option had not been specified. */
>> - ret = 0;
>> + /* --option '' */
>> + if (arg->def->flag & VSH_OFLAG_EMPTY_OK) {
>
> We can't ever get here. We already set ret = 1 earlier in the function
> in that scenario.
>
> Wow, reading through virsh.c, I noticed some more dead code. All
> instances of vshCmdOpt are created with a non-NULL arg->def, yet we
> check for non-NULL arg->def in a lot of places. I think I'll work on a
> replacement patch that fixes this issue and more.
Done here:
https://www.redhat.com/archives/libvir-list/2011-July/msg00997.html
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110715/395fec55/attachment-0001.sig>
More information about the libvir-list
mailing list