mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Make errno error log more useful for getrandom()
Making errno error log more useful for getrandom() call. Adding if statement to make difference between ENOSYS and other errors. Fixes #24500 Signed-off-by: Fernando Fernandez Mancera <ffernandezmancera@gmail.com>
This commit is contained in:
parent
a5be2305e1
commit
313360e6e6
3
changes/ticket24500
Normal file
3
changes/ticket24500
Normal file
@ -0,0 +1,3 @@
|
||||
o Code simplification and refactoring:
|
||||
- Making more useful log messages for errno errors on getrandom() call.
|
||||
Closes ticket 24500.
|
@ -2875,8 +2875,17 @@ crypto_strongest_rand_syscall(uint8_t *out, size_t out_len)
|
||||
tor_assert(errno != EAGAIN);
|
||||
tor_assert(errno != EINTR);
|
||||
|
||||
/* Probably ENOSYS. */
|
||||
log_warn(LD_CRYPTO, "Can't get entropy from getrandom().");
|
||||
/* Useful log message for errno. */
|
||||
if (errno == ENOSYS) {
|
||||
log_warn(LD_CRYPTO, "This warning is caused by ENOSYS error."
|
||||
" You are running a version of Tor built to support"
|
||||
" getrandom(), but the kernel is too old and doesn't"
|
||||
" implement this function.");
|
||||
} else {
|
||||
log_warn(LD_CRYPTO, "Can't get entropy from getrandom(). %s error.",
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
getrandom_works = 0; /* Don't bother trying again. */
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
Loading…
Reference in New Issue
Block a user