Fix use of getrandom() for Linux and WITH_TLS=no.

This commit is contained in:
Roger A. Light 2019-05-16 15:03:40 +01:00
parent ef3e52d40b
commit b1298dff54
2 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,10 @@ Broker:
- Fix detection of incoming v3.1/v3.1.1 bridges. Closes #1263.
- Fix default max_topic_alias listener config not being copied to the in-use
listener when compiled without TLS support.
- Fix random number generation if compiling using WITH_TLS=no and on Linux
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
this feature would be unable to connect.
Clients:
- Fix -L url parsing when `/topic` part is missing.

View File

@ -326,7 +326,7 @@ int util__random_bytes(void *bytes, int count)
rc = MOSQ_ERR_SUCCESS;
}
#elif defined(__GLIBC__) && __GLIBC_PREREQ(2, 25)
if(getrandom(bytes, count, 0) == 0){
if(getrandom(bytes, count, 0) == count){
rc = MOSQ_ERR_SUCCESS;
}
#elif defined(WIN32)