aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/recvfrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/recvfrom.c')
-rw-r--r--sysdeps/mach/hurd/recvfrom.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sysdeps/mach/hurd/recvfrom.c b/sysdeps/mach/hurd/recvfrom.c
index 981b922654..ab41612d71 100644
--- a/sysdeps/mach/hurd/recvfrom.c
+++ b/sysdeps/mach/hurd/recvfrom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1999 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
@@ -17,17 +17,15 @@
Boston, MA 02111-1307, USA. */
#include <errno.h>
+#include <string.h>
#include <sys/socket.h>
#include <hurd.h>
#include <hurd/fd.h>
#include <hurd/socket.h>
-#include <string.h>
/* Read N bytes into BUF through socket FD from peer
at address ADDR (which is ADDR_LEN bytes long).
Returns the number read or -1 for errors. */
-
-/* XXX should be __recvfrom ? */
int
recvfrom (fd, buf, n, flags, addrarg, addr_len)
int fd;
@@ -35,7 +33,7 @@ recvfrom (fd, buf, n, flags, addrarg, addr_len)
size_t n;
int flags;
__SOCKADDR_ARG addrarg;
- size_t *addr_len;
+ socklen_t *addr_len;
{
error_t err;
mach_port_t addrport;
@@ -74,10 +72,11 @@ recvfrom (fd, buf, n, flags, addrarg, addr_len)
if (err)
return __hurd_dfail (fd, err);
+ if (*addr_len > buflen)
+ *addr_len = buflen;
+
if (buf != (char *) addr)
{
- if (*addr_len < buflen)
- *addr_len = buflen;
memcpy (addr, buf, *addr_len);
__vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
}