aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-26 15:53:35 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-01 15:52:54 +0100
commit29d6cd41340a433ca93645df4232d5698b27ae10 (patch)
tree94040d324a0d9b45ab911e08216595637b07216f /src
parent3dd57f737ced1333bb74a03e6af25017291f8f70 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/stream.c13
1 files changed, 3 insertions, 10 deletions
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 @@ int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect)
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);