From b3ba184e31e0e5cc67e7d7fb6594096a068ad1be Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Mon, 26 Apr 2021 21:08:18 -0400 Subject: [PATCH] Fix: FDs are added to payload despite not being received MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit `lttcomm_recv_fds_unix_sock_non_block` can return zero on EAGAIN. It is important not to add the raw_fds array to the payload in such case since concretely no FDs have been received. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I551457856c885098bf0de2388936e97456051f93 --- src/common/unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/unix.c b/src/common/unix.c index 623421cad..ae2b822af 100644 --- a/src/common/unix.c +++ b/src/common/unix.c @@ -780,7 +780,7 @@ ssize_t _lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd, sock, (int *) raw_fds.buffer.data, nb_fd); } - if (ret < 0) { + if (ret <= 0) { goto end; } -- 2.34.1