diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-11-26 09:37:09 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-11-26 09:37:09 +0100 |
commit | 14dd30a13e27afcbdc7cce7203d07b50de48fa53 (patch) | |
tree | ecf92d093c81d421e07cfece216f0bb73f0b1196 | |
parent | 34260c892390c6831a0a5fb906bc3bffcfd08896 (diff) |
fix signed/unsigned bug in ipa_client_conn_open()
If osmo_sock_init() would ever return a negative FD together with
errno == EINPROGRESS, we would have attempted to register that negative
FD with the select() main loop handling, whihc of course doesn't work.
EINPROGRESS for a non-blocking connecting socket is handled inside
osmo_sock_init() and would result in it returning a positive FD, so the
above case is of theoretical significance only.
Change-Id: Id01eb0d48eea6cab1fbc720c52361101b8ea4e35
Fixes: Coverity CID 57856
-rw-r--r-- | src/input/ipa.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/input/ipa.c b/src/input/ipa.c index f90d62c..ce155ce 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -213,10 +213,8 @@ int ipa_client_conn_open(struct ipa_client_conn *link) ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP, link->addr, link->port, OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK); - if (ret < 0) { - if (errno != EINPROGRESS) - return ret; - } + if (ret < 0) + return ret; link->ofd->fd = ret; link->ofd->when |= BSC_FD_WRITE; if (osmo_fd_register(link->ofd) < 0) { |