Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern PT/54527: Anthony Mallet: Don't clear socket errors...
details: https://anonhg.NetBSD.org/src/rev/8ffb24aaa42c
branches: trunk
changeset: 965372:8ffb24aaa42c
user: christos <christos%NetBSD.org@localhost>
date: Sat Sep 14 14:09:54 2019 +0000
description:
PT/54527: Anthony Mallet: Don't clear socket errors for MSG_PEEK.
diffstat:
sys/kern/uipc_socket.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diffs (49 lines):
diff -r bed9e919a6dd -r 8ffb24aaa42c sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Sat Sep 14 12:53:24 2019 +0000
+++ b/sys/kern/uipc_socket.c Sat Sep 14 14:09:54 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.281 2019/07/16 22:57:55 pgoyette Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.282 2019/09/14 14:09:54 christos 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.281 2019/07/16 22:57:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.282 2019/09/14 14:09:54 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -928,7 +928,8 @@
}
if (so->so_error) {
error = so->so_error;
- so->so_error = 0;
+ if ((flags & MSG_PEEK) == 0)
+ so->so_error = 0;
goto release;
}
if ((so->so_state & SS_ISCONNECTED) == 0) {
@@ -1225,15 +1226,13 @@
panic("receive 1");
#endif
if (so->so_error || so->so_rerror) {
+ u_short *e;
if (m != NULL)
goto dontblock;
- if (so->so_error) {
- error = so->so_error;
- so->so_error = 0;
- } else {
- error = so->so_rerror;
- so->so_rerror = 0;
- }
+ *e = so->so_error ? &so->so_error : &so->so_rerror;
+ error = *e;
+ if ((flags & MSG_PEEK) == 0)
+ *e = 0;
goto release;
}
if (so->so_state & SS_CANTRCVMORE) {
Home |
Main Index |
Thread Index |
Old Index