Fix recvmsg returning SIGLOST on PF_LOCAL sockets

when msg_name is not NULL.

	* sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Cope with aport being
	MACH_PORT_NULL.
This commit is contained in:
Samuel Thibault 2016-08-09 01:42:50 +02:00
parent bf79a337ec
commit a194625ef3
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-08-06 Christian Seiler <christian@iwakd.de>
[BZ #20444]
* sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Cope with aport being
MACH_PORT_NULL.
2016-08-05 Aurelien Jarno <aurelien@aurel32.net>
* math/s_fdim.c: Avoid alias renamed.

View File

@ -64,7 +64,7 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags)
&message->msg_flags, amount)))
return __hurd_sockfail (fd, flags, err);
if (message->msg_name != NULL)
if (message->msg_name != NULL && aport != MACH_PORT_NULL)
{
char *buf = message->msg_name;
mach_msg_type_number_t buflen = message->msg_namelen;
@ -98,6 +98,8 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags)
if (buflen > 0)
((struct sockaddr *) message->msg_name)->sa_family = type;
}
else if (message->msg_name != NULL)
message->msg_namelen = 0;
__mach_port_deallocate (__mach_task_self (), aport);