From f9ff58276faf686fc6a443260ba3a6fa9dd998fd Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 16 May 2012 12:03:02 +0100 Subject: [PATCH] Reject any non-option command line arguments 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 (cherry picked from commit 51bcb09fe946c01ff7e0f94fee0be9d6411ca2ad) --- daemon/libvirtd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 19729f478d..b20439b6f4 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -1383,6 +1383,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);