public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] hurd: Make getrandom return ENOSYS when /dev/random is not set up
@ 2023-07-01 12:24 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-07-01 12:24 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=494714d4073502145689eafc197f5ab6ffe4c3e5

commit 494714d4073502145689eafc197f5ab6ffe4c3e5
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sat Jul 1 14:23:40 2023 +0200

    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.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-01 12:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-01 12:24 [glibc] hurd: Make getrandom return ENOSYS when /dev/random is not set up Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).