git: db158b9942c1 - main - libnv: let nvlist_recv() pass flags to recv()

From: Robert Wing <rew_at_FreeBSD.org>
Date: Mon, 06 Dec 2021 18:58:03 UTC
The branch main has been updated by rew:

URL: https://cgit.FreeBSD.org/src/commit/?id=db158b9942c15f13f4fa09bd29435da882cf865c

commit db158b9942c15f13f4fa09bd29435da882cf865c
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2021-12-06 18:36:37 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-12-06 18:54:55 +0000

    libnv: let nvlist_recv() pass flags to recv()
    
    Differential Revision:  https://reviews.freebsd.org/D32721
---
 lib/libnv/msgio.c          | 4 ++--
 lib/libnv/msgio.h          | 2 +-
 sys/contrib/libnv/nvlist.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/libnv/msgio.c b/lib/libnv/msgio.c
index 7cec4c898f04..899f2d3a0ff1 100644
--- a/lib/libnv/msgio.c
+++ b/lib/libnv/msgio.c
@@ -450,7 +450,7 @@ buf_send(int sock, void *buf, size_t size)
 }
 
 int
-buf_recv(int sock, void *buf, size_t size)
+buf_recv(int sock, void *buf, size_t size, int flags)
 {
 	ssize_t done;
 	unsigned char *ptr;
@@ -461,7 +461,7 @@ buf_recv(int sock, void *buf, size_t size)
 	ptr = buf;
 	while (size > 0) {
 		fd_wait(sock, true);
-		done = recv(sock, ptr, size, 0);
+		done = recv(sock, ptr, size, flags);
 		if (done == -1) {
 			if (errno == EINTR)
 				continue;
diff --git a/lib/libnv/msgio.h b/lib/libnv/msgio.h
index 13592e4cd0fb..0686c47f294c 100644
--- a/lib/libnv/msgio.h
+++ b/lib/libnv/msgio.h
@@ -47,6 +47,6 @@ int fd_send(int sock, const int *fds, size_t nfds);
 int fd_recv(int sock, int *fds, size_t nfds);
 
 int buf_send(int sock, void *buf, size_t size);
-int buf_recv(int sock, void *buf, size_t size);
+int buf_recv(int sock, void *buf, size_t size, int flags);
 
 #endif	/* !_MSGIO_H_ */
diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c
index 31ab62abeb67..0ede1ca2f894 100644
--- a/sys/contrib/libnv/nvlist.c
+++ b/sys/contrib/libnv/nvlist.c
@@ -1280,7 +1280,7 @@ nvlist_recv(int sock, int flags)
 	size_t nfds, size, i;
 	int *fds;
 
-	if (buf_recv(sock, &nvlhdr, sizeof(nvlhdr)) == -1)
+	if (buf_recv(sock, &nvlhdr, sizeof(nvlhdr), 0) == -1)
 		return (NULL);
 
 	if (!nvlist_check_header(&nvlhdr))
@@ -1298,7 +1298,7 @@ nvlist_recv(int sock, int flags)
 	ret = NULL;
 	fds = NULL;
 
-	if (buf_recv(sock, buf + sizeof(nvlhdr), size - sizeof(nvlhdr)) == -1)
+	if (buf_recv(sock, buf + sizeof(nvlhdr), size - sizeof(nvlhdr), 0) == -1)
 		goto out;
 
 	if (nfds > 0) {