From: Daniel P. Berrangé Date: Mon, 28 Apr 2025 16:22:14 +0000 (+0100) Subject: util: remove use hardcoded DMIDECODE path X-Git-Tag: v11.4.0-rc1~127 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d3677574764abd25790485c262ea869319cfa98;p=thirdparty%2Flibvirt.git util: remove use hardcoded DMIDECODE path 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 Signed-off-by: Daniel P. Berrangé --- diff --git a/meson.build b/meson.build index 9f6021f692..ee7c30130a 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;