summaryrefslogtreecommitdiff
path: root/arch/linux/common/os.h
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:48 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:48 -0500
commit7c47b5b9584f5011aeba18d7e1b26b3d3124825f (patch)
tree11b07e1c73a22a6ec5ebd710c9a72e972a4c571b /arch/linux/common/os.h
parent4979bb6cbbbe39eb44c32530cd13f86bf44e5d77 (diff)
Import Upstream version 0.5.1
Diffstat (limited to 'arch/linux/common/os.h')
-rw-r--r--arch/linux/common/os.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/arch/linux/common/os.h b/arch/linux/common/os.h
index 01853123..f3c2c2d8 100644
--- a/arch/linux/common/os.h
+++ b/arch/linux/common/os.h
@@ -28,11 +28,13 @@ get_default_gcc_version(void)
NULL)) {
char *return_value;
- if (!(return_value = strstr(buf, "gcc version "))) {
+ if (!(return_value = strstr(buf, "gcc "))) {
goto err;
}
- return_value += sizeof("gcc version");
+ return_value = strstr(return_value, " ") + 1;
+ return_value = strstr(return_value, " ") + 1;
+
return_value = g_strdup_printf("GNU C Compiler version %s", return_value);
g_free(buf);
@@ -53,7 +55,7 @@ get_libc_version(void)
libc = popen("/lib/libc.so.6", "r");
if (!libc) goto err;
- fgets(buf, 256, libc);
+ (void)fgets(buf, 256, libc);
if (pclose(libc)) goto err;
tmp = strstr(buf, "version ");
@@ -80,7 +82,7 @@ get_os_compiled_date(void)
if (!procversion)
return g_strdup("Unknown");
- fgets(buf, 512, procversion);
+ (void)fgets(buf, 512, procversion);
fclose(procversion);
return g_strdup(buf);
@@ -103,7 +105,7 @@ detect_desktop_environment(OperatingSystem * os)
obtain the version. */
version = popen("gnome-about --gnome-version", "r");
if (version) {
- fscanf(version, "Version: %s", vers);
+ (void)fscanf(version, "Version: %s", vers);
if (pclose(version))
goto unknown;
} else {
@@ -112,13 +114,19 @@ detect_desktop_environment(OperatingSystem * os)
os->desktop = g_strdup_printf("GNOME %s", vers);
} else if (g_getenv("KDE_FULL_SESSION")) {
- version = popen("kcontrol --version", "r");
+
+ if (g_getenv("KDE_SESSION_VERSION") && strstr(g_getenv("KDE_SESSION_VERSION"),(gchar *)"4")) {
+ version = popen("kwin --version", "r");
+ } else {
+ version = popen("kcontrol --version", "r");
+ }
+
if (version) {
char buf[32];
- fgets(buf, 32, version);
+ (void)fgets(buf, 32, version);
- fscanf(version, "KDE: %s", vers);
+ (void)fscanf(version, "KDE: %s", vers);
if (pclose(version))
goto unknown;
} else {
@@ -172,7 +180,7 @@ computer_get_os(void)
release = popen("lsb_release -d", "r");
if (release) {
- fgets(buffer, 128, release);
+ (void)fgets(buffer, 128, release);
pclose(release);
os->distro = buffer;
@@ -192,7 +200,7 @@ computer_get_os(void)
char buf[128];
distro_ver = fopen(distro_db[i].file, "r");
- fgets(buf, 128, distro_ver);
+ (void)fgets(buf, 128, distro_ver);
fclose(distro_ver);
buf[strlen(buf) - 1] = 0;