[PATCH 09/21] Fix connect() error return

Valerie Aurora val at versity.com
Tue Feb 11 13:19:06 PST 2025


The return code is alreadly negative (-1); setting itself to its
negative made it positive and broke the error handling code which
assumes -ERRNO. Instead set it to -errno.

Signed-off-by: Valerie Aurora <val at versity.com>
---
 shared/mtr-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/mtr-socket.c b/shared/mtr-socket.c
index c89f79a..3794c0f 100644
--- a/shared/mtr-socket.c
+++ b/shared/mtr-socket.c
@@ -271,7 +271,7 @@ static void socket_connect_thread(struct thread *thr, void *arg)
 
 	ret = connect(fd, (struct sockaddr *)&pinf->addr, sizeof(pinf->addr));
 	if (ret < 0) {
-		ret = -ret;
+		ret = -errno;
 		log("error creating send thread: "ENOF, ENOA(-ret));
 		goto out;
 	}
-- 
2.48.1




More information about the ngnfs-devel mailing list