summaryrefslogtreecommitdiff
path: root/modules/devices/dmi.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-08-15 16:10:25 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2017-08-27 08:21:05 -0700
commitb908a4d67bf37ea35d698b48e68e6d0083943d94 (patch)
tree015ea2cd5489cd025d668f9d87cbc17ddb43a632 /modules/devices/dmi.c
parentaa5f165d7add2d8c9b5e26c5948348cdc9230122 (diff)
DMI: empty result return NULL; don't suggest root if root
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices/dmi.c')
-rw-r--r--modules/devices/dmi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/devices/dmi.c b/modules/devices/dmi.c
index 5ac2c421..3eefd811 100644
--- a/modules/devices/dmi.c
+++ b/modules/devices/dmi.c
@@ -100,6 +100,10 @@ dmi_str_done:
if (ret != NULL) {
ret = strend(ret, '\n');
ret = g_strstrip(ret);
+ if (strlen(ret) == 0) {
+ g_free(ret);
+ ret = NULL;
+ }
}
g_free(full_path);
return ret;
@@ -155,7 +159,9 @@ gboolean dmi_get_info()
dmi_info = h_strdup_cprintf("%s=%s\n",
dmi_info,
_(info->name),
- _("(Not available; Perhaps try running HardInfo as root.)") );
+ (getuid() == 0)
+ ? _("(Not available)")
+ : _("(Not available; Perhaps try running HardInfo as root.)") );
}
}
}