summaryrefslogtreecommitdiffstats
path: root/libdwfl/linux-kernel-modules.c
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2017-04-20 16:08:48 +0200
committerMark Wielaard <[email protected]>2017-05-02 23:24:53 +0200
commite88787f9cd2af5be00aa6f53320cf85f7c08f1f2 (patch)
tree890256f94964ba2361928aa2f5f3bd9fbfb254eb /libdwfl/linux-kernel-modules.c
parentd8437ed5d62a90d18739bc204b83be14188de00f (diff)
Don't look for kernel version if not running on linux
We don't want to use it, even if it exists. Signed-off-by: Ulf Hermann <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdwfl/linux-kernel-modules.c')
-rw-r--r--libdwfl/linux-kernel-modules.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 893110ae..9d0fef2c 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -156,11 +156,18 @@ 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
+ /* Used for finding the running linux kernel, which isn't supported
+ on non-linux kernel systems. */
+ errno = ENOTSUP;
+ return NULL;
+#endif
}
static int