From d873ec45685dbc900e804a36439242bdadc78313 Mon Sep 17 00:00:00 2001 From: hwspeedy Date: Sat, 25 May 2024 12:54:41 +0200 Subject: FIX Memory Devices - remove root suggestion, fix for running as user --- hardinfo2/dmi_util.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'hardinfo2') diff --git a/hardinfo2/dmi_util.c b/hardinfo2/dmi_util.c index 35f9282f..82681820 100644 --- a/hardinfo2/dmi_util.c +++ b/hardinfo2/dmi_util.c @@ -310,8 +310,18 @@ char *dmidecode_read(const dmi_type *type) { snprintf(full_path, PATH_MAX, "dmidecode"); } - spawned = hardinfo_spawn_command_line_sync(full_path, - &out, &err, &i, NULL); + spawned = hardinfo_spawn_command_line_sync(full_path, &out, &err, &i, NULL); + + if (!spawned) { + if(type) { + snprintf(full_path, PATH_MAX, "/sbin/dmidecode -t %"PRId32, *type); + } else { + snprintf(full_path, PATH_MAX, "/sbin/dmidecode"); + } + spawned = hardinfo_spawn_command_line_sync(full_path, &out, &err, &i, NULL); + } + + if (spawned) { if (i == 0) ret = out; -- cgit v1.2.3