]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: remove use hardcoded DMIDECODE path
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 28 Apr 2025 16:22:14 +0000 (17:22 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 2 May 2025 08:31:27 +0000 (09:31 +0100)
Allow virCommand to find 'dmidecode' in $PATH. This command is only
usable when running privileged since it relies on reading from a
privileged kernel file. Thus we can assume both 'bin' and 'sbin' dirs
will be in $PATH and virFindFileInPath will do the right thing to
find it when called by virCommand.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
meson.build
src/util/virsysinfo.c

index 9f6021f6922821a7042840fc87cb59069d0b17a9..ee7c30130a75cdf5ad8de11f37b83bad230686c4 100644 (file)
@@ -854,7 +854,6 @@ optional_test_programs = [
 ]
 
 optional_programs = [
-  'dmidecode',
   'ip',
   'iscsiadm',
   'mdevctl',
index b7413c3bf56424af8176e30b2c7a665607b2ff56..0f12a8964f08f8ee75e25cad332b0499c20c6cfb 100644 (file)
@@ -894,7 +894,7 @@ virSysinfoDMIDecodeOEMString(unsigned int idx,
                              char **str)
 {
     g_autofree char *err = NULL;
-    g_autoptr(virCommand) cmd = virCommandNewArgList(DMIDECODE, "--dump",
+    g_autoptr(virCommand) cmd = virCommandNewArgList("dmidecode", "--dump",
                                                      "--oem-string", NULL);
     virCommandAddArgFormat(cmd, "%u", idx);
     virCommandSetOutputBuffer(cmd, str);
@@ -1199,7 +1199,7 @@ virSysinfoReadDMI(void)
     g_autofree char *outbuf = NULL;
     g_autoptr(virCommand) cmd = NULL;
 
-    cmd = virCommandNewArgList(DMIDECODE, "-q", "-t", "0,1,2,3,4,11,17", NULL);
+    cmd = virCommandNewArgList("dmidecode", "-q", "-t", "0,1,2,3,4,11,17", NULL);
     virCommandSetOutputBuffer(cmd, &outbuf);
     if (virCommandRun(cmd, NULL) < 0)
         return NULL;