From: Daniel P. Berrangé <berra...@redhat.com>

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.

Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
---
 meson.build           | 1 -
 src/util/virsysinfo.c | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index e1d183df23..06a69308ac 100644
--- a/meson.build
+++ b/meson.build
@@ -854,7 +854,6 @@ optional_test_programs = [
 ]
 
 optional_programs = [
-  'dmidecode',
   'ip',
   'iscsiadm',
   'mdevctl',
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index b7413c3bf5..0f12a8964f 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -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;
-- 
2.49.0

Reply via email to