git: 5bdf8150cd7d - main - unix/dgram: don't clear so_error in case of MSG_PEEK
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 01 Feb 2024 21:44:44 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=5bdf8150cd7d19b0bd672992e6f964d30ce66408 commit 5bdf8150cd7d19b0bd672992e6f964d30ce66408 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2024-02-01 21:37:26 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2024-02-01 21:37:26 +0000 unix/dgram: don't clear so_error in case of MSG_PEEK --- sys/kern/uipc_usrreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 554099586bbc..976490dbe2d8 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1440,7 +1440,8 @@ uipc_soreceive_dgram(struct socket *so, struct sockaddr **psa, struct uio *uio, (m = STAILQ_FIRST(&so->so_rcv.uxdg_mb)) == NULL) { if (so->so_error) { error = so->so_error; - so->so_error = 0; + if (!(flags & MSG_PEEK)) + so->so_error = 0; SOCK_RECVBUF_UNLOCK(so); SOCK_IO_RECV_UNLOCK(so); return (error);