summary refs log tree commit diff
path: root/sysdeps/mach/hurd/recvfrom.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-07-30 00:37:36 +0000
committerMiles Bader <miles@gnu.org>1995-07-30 00:37:36 +0000
commitad738d03aeee1a5d780a1875b02f2a7c0afa8291 (patch)
treeebcd74760d0ef05c94ff3142391452d95f623d25 /sysdeps/mach/hurd/recvfrom.c
parent221c50840f70dcc54dd66494c7d8b4c785e9f180 (diff)
downloadglibc-ad738d03aeee1a5d780a1875b02f2a7c0afa8291.tar.gz
glibc-ad738d03aeee1a5d780a1875b02f2a7c0afa8291.tar.xz
glibc-ad738d03aeee1a5d780a1875b02f2a7c0afa8291.zip
(accept): If the protocol family can't tell us what an address means, just return a zero-length buffer instead.
Diffstat (limited to 'sysdeps/mach/hurd/recvfrom.c')
-rw-r--r--sysdeps/mach/hurd/recvfrom.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/recvfrom.c b/sysdeps/mach/hurd/recvfrom.c
index 09d45c7cc8..4a69af41ce 100644
--- a/sysdeps/mach/hurd/recvfrom.c
+++ b/sysdeps/mach/hurd/recvfrom.c
@@ -56,6 +56,14 @@ DEFUN(recvfrom, (fd, buf, n, flags, addr, addr_len),
     int type;
 
     err = __socket_whatis_address (addrport, &type, &buf, &buflen);
+    if (err == EOPNOTSUPP)
+      /* If the protocol server can't tell us the address, just return a
+	 zero-length one.  */
+      {
+	buf = (char *)addr;
+	buflen = 0;
+	err = 0;
+      }
     __mach_port_deallocate (__mach_task_self (), addrport);
     if (err)
       return __hurd_dfail (fd, err);
@@ -68,7 +76,8 @@ DEFUN(recvfrom, (fd, buf, n, flags, addr, addr_len),
 	__vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
       }
 
-    addr->sa_family = type;
+    if (buflen > 0)
+      addr->sa_family = type;
   }
 
   /* Toss control data; we don't care.  */