Change in libosmocore[master]: Fix build on non-glibc systems

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Mar 12 14:56:46 UTC 2019


Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/13209 )

Change subject: Fix build on non-glibc systems
......................................................................

Fix build on non-glibc systems

Change-Id: Id5d577522a4889e152158f7e93ee1c99d3a21003
---
M src/gsm/gsm_utils.c
1 file changed, 8 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  tnt: Looks good to me, but someone else must approve
  Max: Looks good to me, approved



diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c
index 02cb3d5..c9c15d5 100644
--- a/src/gsm/gsm_utils.c
+++ b/src/gsm/gsm_utils.c
@@ -100,7 +100,12 @@
 
 #if (!EMBEDDED)
 /* FIXME: this can be removed once we bump glibc requirements to 2.25: */
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,25)
+#ifdef __GLIBC_PREREQ
+#if __GLIBC_PREREQ(2,25)
+#define HAVE_GLIBC_GETRANDOM
+#endif /* if __GLIBC_PREREQ(2,25) */
+#endif /* ifdef __GLIBC_PREREQ */
+#ifdef HAVE_GLIBC_GETRANDOM
 #pragma message ("glibc " OSMO_STRINGIFY_VAL(__GLIBC__) "." OSMO_STRINGIFY_VAL(__GLIBC_MINOR__) " random detected")
 #include <sys/random.h>
 #undef USE_GNUTLS
@@ -109,7 +114,7 @@
 #ifndef GRND_NONBLOCK
 #define GRND_NONBLOCK 0x0001
 #endif /* ifndef GRND_NONBLOCK */
-#endif /* if __GLIBC_PREREQ */
+#endif /* ifdef HAVE_GLIBC_GETRANDOM */
 #endif /* !EMBEDDED */
 
 #if (USE_GNUTLS)
@@ -447,7 +452,7 @@
 	if (len > OSMO_MAX_RAND_ID_LEN)
                return -E2BIG;
 #if (!EMBEDDED)
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,25)
+#ifdef HAVE_GLIBC_GETRANDOM
 	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")

-- 
To view, visit https://gerrit.osmocom.org/13209
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5d577522a4889e152158f7e93ee1c99d3a21003
Gerrit-Change-Number: 13209
Gerrit-PatchSet: 1
Gerrit-Owner: supersat <supersat at cs.washington.edu>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190312/2f386096/attachment.htm>


More information about the gerrit-log mailing list