diff mbox series

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

Message ID 20211122031619.2202449-2-dominique.martinet@atmark-techno.com
State Changes Requested
Headers show
Series [1/4] ipc_notify_receive: add timeout_ms argument | expand

Commit Message

Dominique Martinet Nov. 22, 2021, 3:16 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>
---
This is an unrelated fix as I was looking at the code, purely
code-inspection level.

 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;
 	}