diff mbox

[08/23] adapter: Return '-errno' when connect() call fails

Message ID 20170615182516.4508-9-mgreer@animalcreek.com (mailing list archive)
State Accepted
Delegated to: Samuel Ortiz
Headers show

Commit Message

Mark Greer June 15, 2017, 6:25 p.m. UTC
near_adapter_connect() incorrectly returns '-1' when the connect()
call fails.  Instead, it should return '-errno' which is the real
error code.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
 src/adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/adapter.c b/src/adapter.c
index bfc64c2..466753b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1054,7 +1054,7 @@  int near_adapter_connect(uint32_t idx, uint32_t target_idx, uint8_t protocol)
 	err = connect(sock, (struct sockaddr *) &addr, sizeof(addr));
 	if (err) {
 		close(sock);
-		return err;
+		return -errno;
 	}
 
 	adapter->tag_sock = sock;