diff mbox series

[v2,2/4] ipc_notify_connect: fix return 0 when message was not acked

Message ID 20211209010659.724523-2-dominique.martinet@atmark-techno.com
State Accepted
Headers show
Series [v2,1/4] ipc_notify_receive: add timeout_ms argument | expand

Commit Message

Dominique MARTINET Dec. 9, 2021, 1:06 a.m. UTC
It's possible to return 'ret' if ret == 0 and msg.type != ACK, but that
is an error as ret >= 0 values could be a valid connfd

(note ret > 0 is not possible in the current code, but it doesn't hurt
to check >= 0 instead of == 0)

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
v2: trivial rebase on master

 ipc/network_ipc.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
index 39ca695ec75f..886af0ac2916 100644
--- a/ipc/network_ipc.c
+++ b/ipc/network_ipc.c
@@ -202,6 +202,8 @@  int ipc_notify_connect(void)
 	if (ret || msg.type != ACK) {
 		fprintf(stdout, "Notify connection handshake failed..\n");
 		close(connfd);
+		if (ret >= 0)
+			ret = -EIO;
 		return ret;
 	}