aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
authorhwspeedy <ns@bigbear.dk>2024-05-25 12:54:41 +0200
committerhwspeedy <ns@bigbear.dk>2024-05-25 12:54:41 +0200
commitd873ec45685dbc900e804a36439242bdadc78313 (patch)
treea372d0609042fbdd3e8899b0741924e250a5cccc /hardinfo2
parent3696112911065b55018e5c0a6b22e94184348b70 (diff)
FIX Memory Devices - remove root suggestion, fix for running as user
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/dmi_util.c14
1 files changed, 12 insertions, 2 deletions
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;