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(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org