Fix compilation problem related to getrandom() on non-glibc systems.

pull/1600/head
Roger A. Light 6 years ago
parent f169e523e1
commit b8abcba74d

@ -9,6 +9,7 @@ Broker:
with glibc >= 2.25. Without this fix, no random numbers would be generated with glibc >= 2.25. Without this fix, no random numbers would be generated
for e.g. on broker client id generation, and so clients connecting expecting for e.g. on broker client id generation, and so clients connecting expecting
this feature would be unable to connect. this feature would be unable to connect.
- Fix compilation problem related to getrandom() on non-glibc systems.
Clients: Clients:
- Fix -L url parsing when `/topic` part is missing. - Fix -L url parsing when `/topic` part is missing.

@ -28,9 +28,10 @@ Contributors:
# include <sys/stat.h> # include <sys/stat.h>
#endif #endif
#if !defined(WITH_TLS) && defined(__linux__) #if !defined(WITH_TLS) && defined(__linux__) && defined(__GLIBC__)
# if defined(__GLIBC__) && __GLIBC_PREREQ(2, 25) # if __GLIBC_PREREQ(2, 25)
# include <sys/random.h> # include <sys/random.h>
# define HAVE_GETRANDOM 1
# endif # endif
#endif #endif
@ -325,7 +326,7 @@ int util__random_bytes(void *bytes, int count)
if(RAND_bytes(bytes, count) == 1){ if(RAND_bytes(bytes, count) == 1){
rc = MOSQ_ERR_SUCCESS; rc = MOSQ_ERR_SUCCESS;
} }
#elif defined(__GLIBC__) && __GLIBC_PREREQ(2, 25) #elif defined(HAVE_GETRANDOM)
if(getrandom(bytes, count, 0) == count){ if(getrandom(bytes, count, 0) == count){
rc = MOSQ_ERR_SUCCESS; rc = MOSQ_ERR_SUCCESS;
} }

Loading…
Cancel
Save