[PATCH] libosmocore[master]: osmo_sock_init2(): Fix creation of non-bound sockets

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jul 21 14:53:56 UTC 2017


Review at  https://gerrit.osmocom.org/3333

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
---
M src/socket.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/3333/1

diff --git a/src/socket.c b/src/socket.c
index ca50b6f..457c991 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -239,7 +239,7 @@
 				rp->ai_protocol = proto;
 			}
 
-			if (!sfd) {
+			if (sfd < 0) {
 				sfd = socket_helper(rp, flags);
 				if (sfd < 0)
 					continue;

-- 
To view, visit https://gerrit.osmocom.org/3333
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0206dbb9c5b8f74d7fb088576941b092acd2ca22
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list