diff mbox series

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

Message ID 20230701122504.2890299-1-samuel.thibault@ens-lyon.org
State New
Headers show
Series [hurd,commited] hurd: Make getrandom return ENOSYS when /dev/random is not set up | expand

Commit Message

Samuel Thibault July 1, 2023, 12:25 p.m. UTC
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 mbox series

Patch

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;
     }