summaryrefslogtreecommitdiff
path: root/sysutils/gnome-system-monitor/patches/patch-aa
blob: 3e4e3b6160cf6b938233bf9282019540a0b60f9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-aa,v 1.2 2009/05/26 19:11:55 wiz Exp $

http://bugzilla.gnome.org/show_bug.cgi?id=583924

--- src/sysinfo.cpp.orig	2007-11-04 21:12:42.000000000 +0100
+++ src/sysinfo.cpp
@@ -190,6 +190,26 @@ namespace {
     }
   };
 
+  class NetBSDSysInfo
+    : public SysInfo
+  {
+  public:
+    NetBSDSysInfo()
+    {
+      this->load_netbsd_info();
+    }
+
+  private:
+    void load_netbsd_info()
+    {
+      this->distro_name = "NetBSD";
+
+      std::ifstream input("/etc/release");
+
+      if (input)
+	std::getline(input, this->distro_release);
+    }
+  };
 
   class LSBSysInfo
     : public SysInfo
@@ -256,10 +276,15 @@ namespace {
       g_free(p);
       return new LSBSysInfo;
     }
+#ifdef __NetBSD__ /* might also have /etc/release */
+    else
+      return new NetBSDSysInfo;
+#else
     else if (g_file_test("/etc/release", G_FILE_TEST_EXISTS))
       return new SolarisSysInfo;
 
     return new SysInfo;
+#endif
   }
 }