Source-Changes-HG archive

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

[src/trunk]: src/sys/kern socket: clear error even when peeking



details:   https://anonhg.NetBSD.org/src/rev/f3e7b0238afa
branches:  trunk
changeset: 360626:f3e7b0238afa
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Mar 19 16:31:24 2018 +0000

description:
socket: clear error even when peeking

The error has already been reported and it's pointless requiring another
recv(2) call just to clear it.

diffstat:

 sys/kern/uipc_socket.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 28b4f8861005 -r f3e7b0238afa sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Mon Mar 19 16:26:25 2018 +0000
+++ b/sys/kern/uipc_socket.c    Mon Mar 19 16:31:24 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.259 2018/01/04 01:42:25 christos Exp $       */
+/*     $NetBSD: uipc_socket.c,v 1.260 2018/03/19 16:31:24 roy 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.259 2018/01/04 01:42:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.260 2018/03/19 16:31:24 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1244,8 +1244,7 @@
                        if (m != NULL)
                                goto dontblock;
                        error = so->so_error;
-                       if ((flags & MSG_PEEK) == 0)
-                               so->so_error = 0;
+                       so->so_error = 0;
                        goto release;
                }
                if (so->so_state & SS_CANTRCVMORE) {



Home | Main Index | Thread Index | Old Index