From 37ed8b9bdc820a23d5884132d0278d9e42942fd3 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 10 May 2012 15:30:38 -0700 Subject: Hurd: recvfrom(): take into account null address ports --- sysdeps/mach/hurd/recvfrom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/mach/hurd/recvfrom.c b/sysdeps/mach/hurd/recvfrom.c index f591336115..3a094aa0d2 100644 --- a/sysdeps/mach/hurd/recvfrom.c +++ b/sysdeps/mach/hurd/recvfrom.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1997, 1999, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1994-2012 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 @@ -54,7 +54,7 @@ __recvfrom (fd, buf, n, flags, addrarg, addr_len) return __hurd_sockfail (fd, flags, err); /* Get address data for the returned address port if requested. */ - if (addr != NULL) + if (addr != NULL && addrport != MACH_PORT_NULL) { char *buf = (char *) addr; mach_msg_type_number_t buflen = *addr_len; @@ -88,6 +88,8 @@ __recvfrom (fd, buf, n, flags, addrarg, addr_len) if (buflen > 0) addr->sa_family = type; } + else if (addr_len != NULL) + *addr_len = 0; __mach_port_deallocate (__mach_task_self (), addrport); -- cgit v1.2.3