]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - hurd/hurdsock.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / hurd / hurdsock.c
index 07eb6a40c147b608f8078fa9076b9cf53d303af9..bb98a6b7454dc00dd37ea8fd51884b1b3800e943 100644 (file)
@@ -1,5 +1,5 @@
 /* _hurd_socket_server - Find the server for a socket domain.
-   Copyright (C) 1991,92,93,94,95,97,99 Free Software Foundation, Inc.
+   Copyright (C) 1991-2018 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
@@ -13,9 +13,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <hurd.h>
 #include <sys/socket.h>
@@ -23,7 +22,7 @@
 #include <string.h>
 #include <hurd/paths.h>
 #include <stdio.h>
-#include "stdio-common/_itoa.h"
+#include <_itoa.h>
 #include <cthreads.h>          /* For `struct mutex'.  */
 #include "hurdmalloc.h"                /* XXX */
 
@@ -47,6 +46,12 @@ _hurd_socket_server (int domain, int dead)
 {
   socket_t server;
 
+  if (domain < 0)
+    {
+      errno = EAFNOSUPPORT;
+      return MACH_PORT_NULL;
+    }
+
   HURD_CRITICAL_BEGIN;
   __mutex_lock (&lock);
 
@@ -92,7 +97,7 @@ _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 = EPFNOSUPPORT;
+    errno = EAFNOSUPPORT;
 
   __mutex_unlock (&lock);
   HURD_CRITICAL_END;