summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1998-08-31 18:07:23 +0000
committerwollman <wollman@FreeBSD.org>1998-08-31 18:07:23 +0000
commitbae4326618e3f49d770051d27112e1c7dde79d7e (patch)
tree638991abfac839c8f5b8b3bc41992a535abea4b2 /sys/kern/uipc_socket.c
parent343eedd829aa40ed9ce1c9d4a8ad1e8152d3d13b (diff)
downloadFreeBSD-src-bae4326618e3f49d770051d27112e1c7dde79d7e.zip
FreeBSD-src-bae4326618e3f49d770051d27112e1c7dde79d7e.tar.gz
Bow to tradition and correctly implement the bogus-but-hallowed semantics
of getsockopt never telling how much it might have copied if only the buffer were big enough.
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index defd2a8..05d312f 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94
- * $Id: uipc_socket.c,v 1.43 1998/08/23 03:06:59 wollman Exp $
+ * $Id: uipc_socket.c,v 1.44 1998/08/31 15:34:55 wollman Exp $
*/
#include <sys/param.h>
@@ -1078,13 +1078,14 @@ sooptcopyout(sopt, buf, len)
/*
* Documented get behavior is that we always return a value,
* possibly truncated to fit in the user's buffer.
- * We leave the correct length in sopt->sopt_valsize,
- * to be copied out in getsockopt(). Note that this
- * interface is not idempotent; the entire answer must
+ * Traditional behavior is that we always tell the user
+ * precisely how much we copied, rather than something useful
+ * like the total amount we had available for her.
+ * Note that this interface is not idempotent; the entire answer must
* generated ahead of time.
*/
valsize = min(len, sopt->sopt_valsize);
- sopt->sopt_valsize = len;
+ sopt->sopt_valsize = valsize;
if (sopt->sopt_val != 0) {
if (sopt->sopt_p != 0)
error = copyout(buf, sopt->sopt_val, valsize);
OpenPOWER on IntegriCloud