summaryrefslogtreecommitdiffstats
path: root/libdwfl
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-03-28 16:45:23 +0200
committerUlf Hermann <ulf.hermann@qt.io>2017-04-26 09:35:43 +0000
commitfc9596af615b96d73e15b26dc83da14e7bde73c5 (patch)
treea783b0842977a1d7eb7989fcffe16707157e7907 /libdwfl
parent7418ca577be88ad40d6aad3c46efda702d5c5294 (diff)
Don't look for kernel version if not running on linux
Change-Id: Ia74c04e2590d2d918fb7d5227a106de789551843 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/linux-kernel-modules.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 74c6e3fb..3fceca05 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+ * linux-kernel-modules.c: Always return NULL from kernel_release() on
+ non-linux systems.
+
+2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+
* dwfl_module_getdwarf.c: Check shnum for 0 before subtracting from
it.
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 893110ae..6c6c6037 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -156,11 +156,15 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug)
static inline const char *
kernel_release (void)
{
+#ifdef __linux__
/* Cache the `uname -r` string we'll use. */
static struct utsname utsname;
if (utsname.release[0] == '\0' && uname (&utsname) != 0)
return NULL;
return utsname.release;
+#else
+ return NULL;
+#endif
}
static int