about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/getsockopt.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-06-07 03:35:22 +0000
committerRoland McGrath <roland@gnu.org>2001-06-07 03:35:22 +0000
commitd652f6b8cb5e2236c049a2b68214be8ce6a25d57 (patch)
tree1e67110c8c349bd86e810916c98ccc6d182ba644 /sysdeps/mach/hurd/getsockopt.c
parenteb12749a92d61fc968ab23596d539012b8852c74 (diff)
downloadglibc-d652f6b8cb5e2236c049a2b68214be8ce6a25d57.tar.gz
glibc-d652f6b8cb5e2236c049a2b68214be8ce6a25d57.tar.xz
glibc-d652f6b8cb5e2236c049a2b68214be8ce6a25d57.zip
2001-06-06 Roland McGrath <roland@frob.com>
	* sysdeps/mach/hurd/getsockopt.c: Fix handling of returned buffer size.
	From Robert Bihlmeyer <robbe@orcus.priv.at>.
Diffstat (limited to 'sysdeps/mach/hurd/getsockopt.c')
-rw-r--r--sysdeps/mach/hurd/getsockopt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/getsockopt.c b/sysdeps/mach/hurd/getsockopt.c
index 36403543df..dec356eb10 100644
--- a/sysdeps/mach/hurd/getsockopt.c
+++ b/sysdeps/mach/hurd/getsockopt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992,94,97,2001 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
@@ -45,10 +45,10 @@ getsockopt (fd, level, optname, optval, optlen)
 						 &buf, &buflen)))
     return __hurd_dfail (fd, err);
 
+  if (*optlen > buflen)
+    *optlen = buflen;
   if (buf != optval)
     {
-      if (*optlen < buflen)
-	*optlen = buflen;
       memcpy (optval, buf, *optlen);
       __vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
     }