1999-03-15 Mark Kettenis <kettenis@gnu.org>

* sysdeps/mach/hurd/poll.c (__poll): Correctly pass NULL to
	_hurd_select if TIMEMOUT is -1.

1999-03-15  Mark Kettenis  <kettenis@gnu.org>

	* sysdeps/mach/hurd/recvfrom.c (recvfrom): Allow ADDR to be NULL.
This commit is contained in:
Roland McGrath 1999-03-15 14:33:27 +00:00
parent 9cfba5dc11
commit d012636f1f
2 changed files with 47 additions and 31 deletions

View File

@ -1,3 +1,12 @@
1999-03-15 Mark Kettenis <kettenis@gnu.org>
* sysdeps/mach/hurd/poll.c (__poll): Correctly pass NULL to
_hurd_select if TIMEMOUT is -1.
1999-03-15 Mark Kettenis <kettenis@gnu.org>
* sysdeps/mach/hurd/recvfrom.c (recvfrom): Allow ADDR to be NULL.
1999-03-15 Ulrich Drepper <drepper@cygnus.com> 1999-03-15 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-load.c: Compute rtld_search_dir array size correctly. * elf/dl-load.c: Compute rtld_search_dir array size correctly.

View File

@ -23,9 +23,10 @@
#include <hurd/fd.h> #include <hurd/fd.h>
#include <hurd/socket.h> #include <hurd/socket.h>
/* Read N bytes into BUF through socket FD from peer /* Read N bytes into BUF through socket FD.
at address ADDR (which is ADDR_LEN bytes long). If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
Returns the number read or -1 for errors. */ the sender, and store the actual size of the address in *ADDR_LEN.
Returns the number of bytes read or -1 for errors. */
int int
recvfrom (fd, buf, n, flags, addrarg, addr_len) recvfrom (fd, buf, n, flags, addrarg, addr_len)
int fd; int fd;
@ -53,37 +54,43 @@ recvfrom (fd, buf, n, flags, addrarg, addr_len)
n))) n)))
return __hurd_dfail (fd, err); return __hurd_dfail (fd, err);
/* Get address data for the returned address port. */ /* Get address data for the returned address port if requested. */
{ if (addr != NULL)
char *buf = (char *) addr; {
mach_msg_type_number_t buflen = *addr_len; char *buf = (char *) addr;
int type; mach_msg_type_number_t buflen = *addr_len;
int type;
err = __socket_whatis_address (addrport, &type, &buf, &buflen); err = __socket_whatis_address (addrport, &type, &buf, &buflen);
if (err == EOPNOTSUPP) if (err == EOPNOTSUPP)
/* If the protocol server can't tell us the address, just return a /* If the protocol server can't tell us the address, just return a
zero-length one. */ zero-length one. */
{ {
buf = (char *)addr; buf = (char *)addr;
buflen = 0; buflen = 0;
err = 0; err = 0;
} }
__mach_port_deallocate (__mach_task_self (), addrport);
if (err)
return __hurd_dfail (fd, err);
if (*addr_len > buflen) if (err)
*addr_len = buflen; {
__mach_port_deallocate (__mach_task_self (), addrport);
if (buf != (char *) addr) return __hurd_dfail (fd, err);
{ }
memcpy (addr, buf, *addr_len);
__vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen); if (*addr_len > buflen)
} *addr_len = buflen;
if (buflen > 0) if (buf != (char *) addr)
addr->sa_family = type; {
} memcpy (addr, buf, *addr_len);
__vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
}
if (buflen > 0)
addr->sa_family = type;
}
__mach_port_deallocate (__mach_task_self (), addrport);
/* Toss control data; we don't care. */ /* Toss control data; we don't care. */
__vm_deallocate (__mach_task_self (), (vm_address_t) cdata, clen); __vm_deallocate (__mach_task_self (), (vm_address_t) cdata, clen);