about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/getsockname.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-02-28 13:01:23 +0000
committerRoland McGrath <roland@gnu.org>1999-02-28 13:01:23 +0000
commit0fd43249a0c6d180a3a2ffc0ff850f6718592a6f (patch)
tree25253a7385e1c97e4c48b83263ccfd8f338080e0 /sysdeps/mach/hurd/getsockname.c
parent5615c549e26bd30b4a9dc2a80b8c380926cf6972 (diff)
downloadglibc-0fd43249a0c6d180a3a2ffc0ff850f6718592a6f.tar.gz
glibc-0fd43249a0c6d180a3a2ffc0ff850f6718592a6f.tar.xz
glibc-0fd43249a0c6d180a3a2ffc0ff850f6718592a6f.zip
1999-02-28 Mark Kettenis <kettenis@gnu.org>
* sysdeps/mach/hurd/getsockname.c (getsockname): Set *LEN to the 
actual length if the adress length is smaller than the input 
value.  Change type of *LEN paramater to socklen_t. 
* sysdeps/mach/hurd/getpeername.c (getpeername): Likewise. 
* sysdeps/mach/hurd/accept.c (accept): Likewise. 
* sysdeps/mach/hurd/recvfrom.c (recvfrom): Likewise. 
* sysdeps/mach/hurd/sendto.c (sendto): Change type of ADDR_LEN 
paramater to socklen_t.
Diffstat (limited to 'sysdeps/mach/hurd/getsockname.c')
-rw-r--r--sysdeps/mach/hurd/getsockname.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/getsockname.c b/sysdeps/mach/hurd/getsockname.c
index ad447eec79..9d049630e6 100644
--- a/sysdeps/mach/hurd/getsockname.c
+++ b/sysdeps/mach/hurd/getsockname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 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,18 +17,18 @@
    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>
 
 /* Put the local address of FD into *ADDR and its length in *LEN.  */
 int
 getsockname (fd, addrarg, len)
      int fd;
      __SOCKADDR_ARG addrarg;
-     size_t *len;
+     socklen_t *len;
 {
   error_t err;
   struct sockaddr *addr = addrarg.__sockaddr__;
@@ -46,10 +46,11 @@ getsockname (fd, addrarg, len)
   if (err)
     return __hurd_dfail (fd, err);
 
+  if (*len > buflen)
+    *len = buflen;
+  
   if (buf != (char *) addr)
     {
-      if (*len < buflen)
-	*len = buflen;
       memcpy (addr, buf, *len);
       __vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
     }