diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-07-01 14:23:40 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-07-01 14:23:40 +0200 |
commit | 494714d4073502145689eafc197f5ab6ffe4c3e5 (patch) | |
tree | 68a6aefefb98b0e63cd111369f2b5d4159f22895 /sysdeps/mach | |
parent | 0a9e93842d8e535ac8174cb4ff7fb830b20e4ae7 (diff) | |
download | glibc-494714d4073502145689eafc197f5ab6ffe4c3e5.tar.gz glibc-494714d4073502145689eafc197f5ab6ffe4c3e5.tar.xz glibc-494714d4073502145689eafc197f5ab6ffe4c3e5.zip |
hurd: Make getrandom return ENOSYS when /dev/random is not set up
So that callers (e.g. __arc4random_buf) don't try calling it again.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/getrandom.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/getrandom.c b/sysdeps/mach/hurd/getrandom.c index 0d28f5c260..a7706afe82 100644 --- a/sysdeps/mach/hurd/getrandom.c +++ b/sysdeps/mach/hurd/getrandom.c @@ -123,8 +123,13 @@ again: open_flags, 0); __libc_rwlock_unlock (lock); if (!MACH_PORT_VALID (server)) - /* No luck. */ - return -1; + { + if (errno == ENOENT) + /* No translator set up, we won't have support for it. */ + errno = ENOSYS; + /* No luck. */ + return -1; + } goto again; } |