From 29d6cd41340a433ca93645df4232d5698b27ae10 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 26 Nov 2016 15:53:35 +0100 Subject: 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 --- src/stream.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src') 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); -- cgit v1.2.3