mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-19 19:43:34 -04:00
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 <ulf.hermann@qt.io> Signed-off-by: Mark Wielaard <mark@klomp.org>
This commit is contained in:
committed by
Mark Wielaard
parent
d8437ed5d6
commit
e88787f9cd
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user