Bug #3832 ยป glibc_prereq.patch
src/gsm/gsm_utils.c | ||
---|---|---|
100 | 100 | |
101 | 101 |
#if (!EMBEDDED) |
102 | 102 |
/* FIXME: this can be removed once we bump glibc requirements to 2.25: */ |
103 |
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,25) |
|
103 |
#ifdef __GLIBC_PREREQ |
|
104 |
#if __GLIBC_PREREQ(2,25) |
|
105 |
#define HAVE_GLIBC_GETRANDOM |
|
106 |
#endif /* if __GLIBC_PREREQ(2,25) */ |
|
107 |
#endif /* ifdef __GLIBC_PREREQ */ |
|
108 |
#ifdef HAVE_GLIBC_GETRANDOM |
|
104 | 109 |
#pragma message ("glibc " OSMO_STRINGIFY_VAL(__GLIBC__) "." OSMO_STRINGIFY_VAL(__GLIBC_MINOR__) " random detected") |
105 | 110 |
#include <sys/random.h> |
106 | 111 |
#undef USE_GNUTLS |
... | ... | |
109 | 114 |
#ifndef GRND_NONBLOCK |
110 | 115 |
#define GRND_NONBLOCK 0x0001 |
111 | 116 |
#endif /* ifndef GRND_NONBLOCK */ |
112 |
#endif /* if __GLIBC_PREREQ */
|
|
117 |
#endif /* ifdef HAVE_GLIBC_GETRANDOM */
|
|
113 | 118 |
#endif /* !EMBEDDED */ |
114 | 119 | |
115 | 120 |
#if (USE_GNUTLS) |
... | ... | |
447 | 452 |
if (len > OSMO_MAX_RAND_ID_LEN) |
448 | 453 |
return -E2BIG; |
449 | 454 |
#if (!EMBEDDED) |
450 |
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,25)
|
|
455 |
#if HAVE_GLIBC_GETRANDOM
|
|
451 | 456 |
rc = getrandom(out, len, GRND_NONBLOCK); |
452 | 457 |
#elif HAVE_DECL_SYS_GETRANDOM |
453 | 458 |
#pragma message ("Using direct syscall access for getrandom(): consider upgrading to glibc >= 2.25") |