]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: fix regression in argv parsing
authorEric Blake <eblake@redhat.com>
Wed, 21 Sep 2011 14:54:47 +0000 (08:54 -0600)
committerDaniel Veillard <veillard@redhat.com>
Thu, 22 Sep 2011 05:28:18 +0000 (13:28 +0800)
commit466f902446223d62ad0753b6eb1f93b15a9ee764
treeeb3193680012cd15113f444ca407351b7e8ea397
parent2f0595244b73d7d67447bddf4c5e39f597f5e914
virsh: fix regression in argv parsing

Prior to commit 85d2810, we had an issue where:

snapshot-create-as dom name --diskspec spec --diskspec spec

failed to parse the second spec, because the first spec had marked
that option as no longer requiring an argument.

In commit 85d2810, I fixed it by making argv options no longer mark
the option as seen.  But this in turn breaks mandatory argv options,
which now complain that the argv option is missing.

This patch reverts that part of 85d2810, and instead replaces it with
fixes to no longer clear opts_need_arg of an argv argument.

* tools/virsh.c (vshCmddefGetOption, vshCmddefGetData)
(vshCommandParse): Fix option parsing for required argv option.
(vshCmddefOptParse): Check that argv option is last.
* tests/virsh-optparse: Enhance test.
tests/virsh-optparse
tools/virsh.c