mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 12:40:36 +01:00
systemd: fix compilation if libc doesn't provide getrandom()
Before commit650a7022c1, we would always forego using getrandom(). That changed, and now we detect at compile time whether getrandom() is provided by libc. So, if you build against recent libc, we use it too. However, systemd's src/basic/missing_syscall.h also provides getrandom() by calling the syscall directly. We don't do that, because it seems too cumbersome to maintain. Fixes:650a7022c1
This commit is contained in:
parent
650a7022c1
commit
8b26cf4365
1 changed files with 7 additions and 0 deletions
|
|
@ -60,7 +60,14 @@ int acquire_random_bytes(void *p, size_t n, bool high_quality_required) {
|
|||
|
||||
/* Use the getrandom() syscall unless we know we don't have it. */
|
||||
if (have_syscall != 0) {
|
||||
#if !HAVE_GETRANDOM
|
||||
/* XXX: NM: systemd calls the syscall directly in this case. Don't add that workaround.
|
||||
* If you don't compile against a libc that provides getrandom(), you don't get it. */
|
||||
r = -1;
|
||||
errno = ENOSYS;
|
||||
#else
|
||||
r = getrandom(p, n, GRND_NONBLOCK);
|
||||
#endif
|
||||
if (r > 0) {
|
||||
have_syscall = true;
|
||||
if ((size_t) r == n)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue