aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/arch/linux/common/net.h4
-rw-r--r--hardinfo2/arch/linux/common/os.h10
2 files changed, 10 insertions, 4 deletions
diff --git a/hardinfo2/arch/linux/common/net.h b/hardinfo2/arch/linux/common/net.h
index 8c083a9e..6575d199 100644
--- a/hardinfo2/arch/linux/common/net.h
+++ b/hardinfo2/arch/linux/common/net.h
@@ -216,6 +216,7 @@ void get_net_info(char *if_name, NetInfo * netinfo)
#endif
shutdown(fd, 0);
+ close(fd);
}
static struct {
@@ -309,6 +310,9 @@ static void scan_net_interfaces_24(void)
network_icons = g_strdup("");
proc_net = fopen("/proc/net/dev", "r");
+ if (!proc_net)
+ return;
+
while (fgets(buffer, 256, proc_net)) {
if (strchr(buffer, ':')) {
gint trash;
diff --git a/hardinfo2/arch/linux/common/os.h b/hardinfo2/arch/linux/common/os.h
index 5654e8b4..01853123 100644
--- a/hardinfo2/arch/linux/common/os.h
+++ b/hardinfo2/arch/linux/common/os.h
@@ -171,11 +171,13 @@ computer_get_os(void)
gchar buffer[128];
release = popen("lsb_release -d", "r");
- fgets(buffer, 128, release);
- pclose(release);
+ if (release) {
+ fgets(buffer, 128, release);
+ pclose(release);
- os->distro = buffer;
- os->distro = g_strdup(os->distro + strlen("Description:\t"));
+ os->distro = buffer;
+ os->distro = g_strdup(os->distro + strlen("Description:\t"));
+ }
}
for (i = 0;; i++) {