diff --git a/src/common/slurm_protocol_socket_implementation.c b/src/common/slurm_protocol_socket_implementation.c
index 83dafb95c39659c79291ef1d15b6c8fe3f2357ae..672e0406381f20db8d498476766867f29350d2e9 100644
--- a/src/common/slurm_protocol_socket_implementation.c
+++ b/src/common/slurm_protocol_socket_implementation.c
@@ -604,10 +604,10 @@ extern int _slurm_connect (int __fd, struct sockaddr const * __addr,
 		debug2("_slurm_connect poll timeout: %m");
 		return -1;
 	} else {
-		/* poll saw an event on the socket */
-		/* We need to check if the connection succeeded by
-		   using getsockopt.  The revent is not necessarily
-		   POLLERR when the connection fails! */
+		/* poll saw some event on the socket
+		 * We need to check if the connection succeeded by
+		 * using getsockopt.  The revent is not necessarily
+		 * POLLERR when the connection fails! */
 		len = sizeof(err);
 		if (getsockopt(__fd, SOL_SOCKET, SO_ERROR,
 			       &err, &len) < 0)
@@ -618,9 +618,9 @@ done:
 	fcntl(__fd, F_SETFL, flags);
 
 	if (err) {
-		errno = err;
+		slurm_seterrno(err);
 		debug2("_slurm_connect failed: %m");
-		errno = err;
+		slurm_seterrno(err);
 		return -1;
 	}