mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
fix return code check on syscall (issue #524)
This commit is contained in:
parent
7cde509b68
commit
9c583eb910
1 changed files with 1 additions and 1 deletions
|
@ -239,7 +239,7 @@ static bool os_random_buf(void* buf, size_t buf_len) {
|
||||||
if (mi_atomic_load_acquire(&no_getrandom)==0) {
|
if (mi_atomic_load_acquire(&no_getrandom)==0) {
|
||||||
ssize_t ret = syscall(SYS_getrandom, buf, buf_len, GRND_NONBLOCK);
|
ssize_t ret = syscall(SYS_getrandom, buf, buf_len, GRND_NONBLOCK);
|
||||||
if (ret >= 0) return (buf_len == (size_t)ret);
|
if (ret >= 0) return (buf_len == (size_t)ret);
|
||||||
if (ret != ENOSYS) return false;
|
if (errno != ENOSYS) return false;
|
||||||
mi_atomic_store_release(&no_getrandom, 1UL); // don't call again, and fall back to /dev/urandom
|
mi_atomic_store_release(&no_getrandom, 1UL); // don't call again, and fall back to /dev/urandom
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue