commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd, commited] hurd: Make getrandom return ENOSYS when /dev/random is


From: Samuel Thibault
Subject: [hurd, commited] hurd: Make getrandom return ENOSYS when /dev/random is not set up
Date: Sat, 1 Jul 2023 14:25:04 +0200

So that callers (e.g. __arc4random_buf) don't try calling it again.
---
 sysdeps/mach/hurd/getrandom.c | 9 +++++++--
 1 file 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;
     }
-- 
2.40.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]