[PATCH] libosmo-netif[master]: osmo_stream_cli_open2(): Fix bogus EINPROGRESS handling

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
Sat Nov 26 14:55:55 UTC 2016


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

osmo_stream_cli_open2(): Fix bogus EINPROGRESS handling

osmo_sock_init() never returns -1 + errno EINPROGRESS. It will return a
positive fd in case the connect operation is in progress. Therefore,
the related code in osmo_stream_cli_open2() was impossible to execute.

Change-Id: Id3483d1d1d4d2eabba94729ea29e5c93b33abff0
Fixes: Coverity CID 57861
---
M src/stream.c
1 file changed, 3 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/36/1336/1

diff --git a/src/stream.c b/src/stream.c
index 0ef54c6..a30fd04 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -308,16 +308,9 @@
 	ret = osmo_sock_init(AF_INET, SOCK_STREAM, cli->proto,
 			     cli->addr, cli->port,
 			     OSMO_SOCK_F_CONNECT);
-	if (ret < 0) {
-		if (errno != EINPROGRESS) {
-			if (reconnect) {
-				osmo_timer_schedule(&cli->timer, cli->reconnect_timeout, 0);
-				cli->state = STREAM_CLI_STATE_CONNECTING;
-				return 0;
-			} else
-				return ret;
-		}
-	}
+	if (ret < 0)
+		return ret;
+
 	cli->ofd.fd = ret;
 	if (osmo_fd_register(&cli->ofd) < 0) {
 		close(ret);

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

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



More information about the gerrit-log mailing list