void-packages/srcpkgs/libosmocore/patches/fix-musl.patch
2019-01-20 01:36:08 -02:00

43 lines
1.5 KiB
Diff

diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c
index 02cb3d5..5233b63 100644
--- src/gsm/gsm_utils.c
+++ src/gsm/gsm_utils.c
@@ -100,7 +100,8 @@
#if (!EMBEDDED)
/* FIXME: this can be removed once we bump glibc requirements to 2.25: */
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,25)
+#if defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2,25)
#pragma message ("glibc " OSMO_STRINGIFY_VAL(__GLIBC__) "." OSMO_STRINGIFY_VAL(__GLIBC_MINOR__) " random detected")
#include <sys/random.h>
#undef USE_GNUTLS
@@ -109,7 +110,8 @@
#ifndef GRND_NONBLOCK
#define GRND_NONBLOCK 0x0001
#endif /* ifndef GRND_NONBLOCK */
-#endif /* if __GLIBC_PREREQ */
+#endif /* if defined( __GLIBC_PREREQ) */
+#endif /* if __GLIB_PREREQ(2,24) */
#endif /* !EMBEDDED */
#if (USE_GNUTLS)
@@ -447,13 +449,15 @@ int osmo_get_rand_id(uint8_t *out, size_t len)
if (len > OSMO_MAX_RAND_ID_LEN)
return -E2BIG;
#if (!EMBEDDED)
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,25)
+#if defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2,25)
rc = getrandom(out, len, GRND_NONBLOCK);
#elif HAVE_DECL_SYS_GETRANDOM
#pragma message ("Using direct syscall access for getrandom(): consider upgrading to glibc >= 2.25")
/* FIXME: this can be removed once we bump glibc requirements to 2.25: */
rc = syscall(SYS_getrandom, out, len, GRND_NONBLOCK);
-#endif
+#endif /* if __GLIBC_PREREQ(2,25) */
+#endif /* if defined(__GLIBC_PREREQ) */
#endif /* !EMBEDDED */
/* getrandom() failed entirely: */