From 5cfa6dc99324b86a104c697e3ffe8f6d82bd3a22 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 21 Jul 2017 16:52:29 +0200 Subject: osmo_sock_init2(): Fix creation of non-bound sockets If osmo_sock_init2() was used with CONNECT flag but without BIND flag, an invalid check for "did we create a socket yet" caused the socket to never be created, and subsequently the entire function to return an error. Change-Id: I0206dbb9c5b8f74d7fb088576941b092acd2ca22 --- src/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/socket.c b/src/socket.c index ca50b6f4..457c991d 100644 --- a/src/socket.c +++ b/src/socket.c @@ -239,7 +239,7 @@ int osmo_sock_init2(uint16_t family, uint16_t type, uint8_t proto, rp->ai_protocol = proto; } - if (!sfd) { + if (sfd < 0) { sfd = socket_helper(rp, flags); if (sfd < 0) continue; -- cgit v1.2.3