]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Don't look for kernel version if not running on linux
authorUlf Hermann <ulf.hermann@qt.io>
Thu, 20 Apr 2017 14:08:48 +0000 (16:08 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 2 May 2017 21:24:53 +0000 (23:24 +0200)
We don't want to use it, even if it exists.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/ChangeLog
libdwfl/linux-kernel-modules.c

index 1fc9da69d479d0a40600cef2cdadaf1145051c3d..859b2ff56a83e7784f928d20c7055fd15b9736cb 100644 (file)
@@ -1,3 +1,9 @@
+2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
+           Mark Wielaard  <mark@klomp.org>
+
+       * linux-kernel-modules.c: Always return NULL from kernel_release() on
+       non-linux systems and set errno to ENOTSUP.
+
 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
 
        * libdwflP.h: Don't include config.h.
index 893110ae83edb6e4aad4a0ef8c7ed80bdaa45d00..9d0fef2cf260116267678c0d47ab7ba099e11c47 100644 (file)
@@ -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