[libvirt] [PATCH libvirt] Reject any non-option command line arguments

From: "Daniel P. Berrange" <berrange@redhat.com> Due to a bug in editing /etc/sysconfig/libvirtd, VDSM was causing libvirt processes to run with the following command line args /usr/sbin/libvirtd --listen '#' 'by vdsm' While it correctly rejects any invalid option flags, libvirtd was not rejecting any non-option command line arguments * daemon/libvirtd.c: Reject non-option argv --- daemon/libvirtd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 2696c54..0b5ae35 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -999,6 +999,12 @@ int main(int argc, char **argv) { } } + if (optind != argc) { + fprintf(stderr, "%s: unexpected, non-option, command line arguments\n", + argv[0]); + exit(EXIT_FAILURE); + } + if (!(config = daemonConfigNew(privileged))) { VIR_ERROR(_("Can't create initial configuration")); exit(EXIT_FAILURE); -- 1.7.10.1

On 05/16/2012 05:05 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Due to a bug in editing /etc/sysconfig/libvirtd, VDSM was causing libvirt processes to run with the following command line args
/usr/sbin/libvirtd --listen '#' 'by vdsm'
While it correctly rejects any invalid option flags, libvirtd was not rejecting any non-option command line arguments
* daemon/libvirtd.c: Reject non-option argv --- daemon/libvirtd.c | 6 ++++++ 1 file changed, 6 insertions(+)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake