aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-07-21 16:52:29 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-21 16:53:46 +0200
commit5cfa6dc99324b86a104c697e3ffe8f6d82bd3a22 (patch)
tree1d6c432623f95d0a4d9fa27c80ba960097db5be5
parenta7ccf6158c1e0ad87bda1f5cac07b4aa1bbcf6b2 (diff)
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
-rw-r--r--src/socket.c2
1 files changed, 1 insertions, 1 deletions
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;