[PATCH v4 07/13] virdnsmasq: Don't run 'dnsmasq --help'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We don't query any capabilities of dnsmasq. We are only
interested in dnsmasq's version (obtained via 'dnsmasq
--version'). Therefore, there's no point in running 'dnsmasq
--help'. Its output is not processed even.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/util/virdnsmasq.c       | 14 +-------------
 tests/networkxml2conftest.c |  2 +-
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 9f50ce7755..5bed8817e5 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -648,10 +648,7 @@ static int
 dnsmasqCapsRefreshInternal(dnsmasqCaps *caps)
 {
     g_autoptr(virCommand) vercmd = NULL;
-    g_autoptr(virCommand) helpcmd = NULL;
-    g_autofree char *help = NULL;
     g_autofree char *version = NULL;
-    g_autofree char *complete = NULL;
 
     /* Make sure the binary we are about to try exec'ing exists.
      * Technically we could catch the exec() failure, but that's
@@ -670,16 +667,7 @@ dnsmasqCapsRefreshInternal(dnsmasqCaps *caps)
     if (virCommandRun(vercmd, NULL) < 0)
         return -1;
 
-    helpcmd = virCommandNewArgList(caps->binaryPath, "--help", NULL);
-    virCommandSetOutputBuffer(helpcmd, &help);
-    virCommandAddEnvPassCommon(helpcmd);
-    virCommandClearCaps(helpcmd);
-    if (virCommandRun(helpcmd, NULL) < 0)
-        return -1;
-
-    complete = g_strdup_printf("%s\n%s", version, help);
-
-    return dnsmasqCapsSetFromBuffer(caps, complete);
+    return dnsmasqCapsSetFromBuffer(caps, version);
 }
 
 static dnsmasqCaps *
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index d79c2b4783..6a2c70ead1 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -114,7 +114,7 @@ mymain(void)
     int ret = 0;
     g_autoptr(dnsmasqCaps) full = NULL;
 
-    full = dnsmasqCapsNewFromBuffer("Dnsmasq version 2.67\n--bind-dynamic\n--ra-param");
+    full = dnsmasqCapsNewFromBuffer("Dnsmasq version 2.67");
 
 #define DO_TEST(xname, xcaps) \
     do { \
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux