From ad738d03aeee1a5d780a1875b02f2a7c0afa8291 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Sun, 30 Jul 1995 00:37:36 +0000 Subject: (accept): If the protocol family can't tell us what an address means, just return a zero-length buffer instead. --- sysdeps/mach/hurd/accept.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sysdeps/mach/hurd/accept.c') diff --git a/sysdeps/mach/hurd/accept.c b/sysdeps/mach/hurd/accept.c index 48402b1227..528d4252fd 100644 --- a/sysdeps/mach/hurd/accept.c +++ b/sysdeps/mach/hurd/accept.c @@ -45,7 +45,17 @@ DEFUN(accept, (fd, addr, addr_len), return __hurd_dfail (fd, err); if (addr != NULL) - err = __socket_whatis_address (aport, &type, &buf, &buflen); + { + err = __socket_whatis_address (aport, &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 (), aport); if (err) @@ -64,7 +74,8 @@ DEFUN(accept, (fd, addr, addr_len), __vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen); } - addr->sa_family = type; + if (buflen > 0) + addr->sa_family = type; } return _hurd_intern_fd (new, O_IGNORE_CTTY, 1); -- cgit v1.2.1