]> xenbits.xensource.com Git - libvirt.git/commitdiff
Reject any non-option command line arguments
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 16 May 2012 11:03:02 +0000 (12:03 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 16 May 2012 11:03:02 +0000 (12:03 +0100)
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

index 2696c548964be36cc07a4efd7d9520a6f1c20ce3..0b5ae350683180de797d1f86f8e6c3ba68507669 100644 (file)
@@ -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);