X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=hurd%2Fhurdsock.c;h=16bca5e7d767bff83623d1e71b1e2e4eb967918b;hb=HEAD;hp=4b32ad431435a0d62133c5156913fb77d3c5c62e;hpb=63643c85d4c47512decc16f35124160629c39a86;p=thirdparty%2Fglibc.git diff --git a/hurd/hurdsock.c b/hurd/hurdsock.c index 4b32ad43143..16bca5e7d76 100644 --- a/hurd/hurdsock.c +++ b/hurd/hurdsock.c @@ -1,5 +1,5 @@ /* _hurd_socket_server - Find the server for a socket domain. - Copyright (C) 1991-2012 Free Software Foundation, Inc. + Copyright (C) 1991-2024 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,7 +14,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #include #include @@ -23,8 +23,9 @@ #include #include #include <_itoa.h> -#include /* For `struct mutex'. */ +#include /* For `struct mutex'. */ #include "hurdmalloc.h" /* XXX */ +#include "set-hooks.h" static struct mutex lock; @@ -47,11 +48,9 @@ _hurd_socket_server (int domain, int dead) socket_t server; if (domain < 0) - { - errno = EAFNOSUPPORT; - return MACH_PORT_NULL; - } + return __hurd_fail (EAFNOSUPPORT), MACH_PORT_NULL; +retry: HURD_CRITICAL_BEGIN; __mutex_lock (&lock); @@ -97,15 +96,18 @@ _hurd_socket_server (int domain, int dead) if (server == MACH_PORT_NULL && errno == ENOENT) /* If the server node is absent, we don't support that protocol. */ - errno = EAFNOSUPPORT; + __hurd_fail (EAFNOSUPPORT); __mutex_unlock (&lock); HURD_CRITICAL_END; + if (server == MACH_PORT_NULL && errno == EINTR) + /* Got a signal while inside an RPC of the critical section, retry again */ + goto retry; return server; } -static void +static void attribute_used_retain init (void) { int i; @@ -114,7 +116,5 @@ init (void) for (i = 0; i < max_domain; ++i) servers[i] = MACH_PORT_NULL; - - (void) &init; /* Avoid "defined but not used" warning. */ } -text_set_element (_hurd_preinit_hook, init); +SET_RELHOOK (_hurd_preinit_hook, init);