diff mbox

[07/23] adapter: Return '-errno' when socket() call fails

Message ID 20170615182516.4508-8-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 socket()
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 bc29ace..bfc64c2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1044,7 +1044,7 @@  int near_adapter_connect(uint32_t idx, uint32_t target_idx, uint8_t protocol)
 
 	sock = socket(AF_NFC, SOCK_SEQPACKET, NFC_SOCKPROTO_RAW);
 	if (sock == -1)
-		return sock;
+		return -errno;
 
 	addr.sa_family = AF_NFC;
 	addr.dev_idx = idx;