summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-26 14:09:34 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-26 17:10:29 +0100
commit3c165d02bb7f004ffcafdc281c03f45149850cb9 (patch)
tree8f5237a138dafe0de2a854d51e081579d7b3c6a7
parent54f44ec5859cfe1b0dd3bf41762124f3ff4e27e0 (diff)
ipaccess-proxy: Check setsockopt() return value
Change-Id: I34b082907b6f0b25fe2779f3a1f0a642a9002664 Fixes: Coverity CID 57642
-rw-r--r--openbsc/src/ipaccess/ipaccess-proxy.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c
index 52e77e8e4..9e8ec88e3 100644
--- a/openbsc/src/ipaccess/ipaccess-proxy.c
+++ b/openbsc/src/ipaccess/ipaccess-proxy.c
@@ -1023,7 +1023,13 @@ static struct ipa_proxy_conn *connect_bsc(struct sockaddr_in *sa, int priv_nr, v
return NULL;
}
- setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ ret = setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ if (ret < 0) {
+ LOGP(DLINP, LOGL_ERROR, "Could not set socket option\n");
+ close(bfd->fd);
+ talloc_free(ipc);
+ return NULL;
+ }
ret = connect(bfd->fd, (struct sockaddr *) sa, sizeof(*sa));
if (ret < 0) {