Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Update getsockopt(SO_ERROR) to behave like soreceiv...



details:   https://anonhg.NetBSD.org/src/rev/9e0ba6aeb875
branches:  trunk
changeset: 836805:9e0ba6aeb875
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Nov 07 09:58:19 2018 +0000

description:
Update getsockopt(SO_ERROR) to behave like soreceive() and
return and clear so->so_rerror if so->so_error is zero.

Ok: christos@

diffstat:

 sys/kern/uipc_socket.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r f78ce6c5f6a4 -r 9e0ba6aeb875 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Wed Nov 07 07:49:10 2018 +0000
+++ b/sys/kern/uipc_socket.c    Wed Nov 07 09:58:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.266 2018/11/04 16:30:29 christos Exp $       */
+/*     $NetBSD: uipc_socket.c,v 1.267 2018/11/07 09:58:19 hannken Exp $        */
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.266 2018/11/04 16:30:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.267 2018/11/07 09:58:19 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1974,6 +1974,10 @@
                break;
 
        case SO_ERROR:
+               if (so->so_error == 0) {
+                       so->so_error = so->so_rerror;
+                       so->so_rerror = 0;
+               }
                error = sockopt_setint(sopt, so->so_error);
                so->so_error = 0;
                break;



Home | Main Index | Thread Index | Old Index