blob: f0eacfb6733d5ad3c9c9fb5a8ddfd1afe2ce0749 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
diff --git a/lib/util_mosq.c b/lib/util_mosq.c
index 8f3610a..5dbf123 100644
--- a/lib/util_mosq.c
+++ b/lib/util_mosq.c
@@ -29,8 +29,10 @@ Contributors:
#endif
#if !defined(WITH_TLS) && defined(__linux__)
-# if defined(__GLIBC__) && __GLIBC_PREREQ(2, 25)
-# include <sys/random.h>
+# if defined(__GLIBC__)
+# if __GLIBC_PREREQ(2, 25)
+# include <sys/random.h>
+# endif
# endif
#endif
@@ -325,10 +327,12 @@ int util__random_bytes(void *bytes, int count)
if(RAND_bytes(bytes, count) == 1){
rc = MOSQ_ERR_SUCCESS;
}
-#elif defined(__GLIBC__) && __GLIBC_PREREQ(2, 25)
+#elif defined(__GLIBC__)
+# if __GLIBC_PREREQ(2, 25)
if(getrandom(bytes, count, 0) == 0){
rc = MOSQ_ERR_SUCCESS;
}
+# endif
#elif defined(WIN32)
HRYPTPROV provider;
|