This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] Don't look for kernel version if not running on linux
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: <elfutils-devel at sourceware dot org>
- Date: Thu, 20 Apr 2017 16:08:48 +0200
- Subject: [PATCH] Don't look for kernel version if not running on linux
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=qt.io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WtJOxOjKJ2ZVB+VyZQeZsrs7RVO5VZqZCWQ9e3pgpVs=; b=gEltaKYZaspzGkdqVZYgsBnaY2mZ5PFLawUR0Uc+X5LNwCiLuxcVPaIMaswyU4XhK7MIS6mUvHxlA2OT3qF5hIfx/gnUgZLVZSErpLpa8w6X0hDeyK0/BY8Y6JuVwGOxlhY1YU/gsbkXiVNywHJLt1Q1OndsUwcpqyIUNRvqzX0=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
We don't want to use it, even if it exists.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/linux-kernel-modules.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index de73d79..80346d5 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 757eace..381711a 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
--
2.1.4