[PATCH 2/3] virdnsmasq: Lookup DNSMASQ in PATH

Michal Privoznik mprivozn at redhat.com
Mon Jan 10 15:44:55 UTC 2022


While it's true that our virCommand subsystem is happy with
non-absolute paths, the dnsmasq capability code is not. For
instance, it does call stat() over the binary to learn its mtime
(and thus decide whether capabilities need to be fetched again or
not).

Therefore, when constructing the capabilities structure look up
the binary path. If DNSMASQ already contains an absolute path
then it is returned (and virFindFileInPath() is a NOP).

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/util/virdnsmasq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index d304929d51..b6ccb9d0a4 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -708,7 +708,7 @@ dnsmasqCapsNewEmpty(void)
         return NULL;
     if (!(caps = virObjectNew(dnsmasqCapsClass)))
         return NULL;
-    caps->binaryPath = g_strdup(DNSMASQ);
+    caps->binaryPath = virFindFileInPath(DNSMASQ);
     return caps;
 }
 
-- 
2.34.1




More information about the libvir-list mailing list