summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-26 14:06:52 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-26 17:10:29 +0100
commit54f44ec5859cfe1b0dd3bf41762124f3ff4e27e0 (patch)
tree0326fc61e09bf7337c4159dd9d386d6304e9b79d
parent18712f0bd1ea9dcad040da996e9f7071dfaec759 (diff)
ipaccess-config: Handle setsockopt return value
Change-Id: I8c2082f9a9c865cc663ad2abb63ee0f70914dabe Fixes: Coverity CID 57640
-rw-r--r--openbsc/src/ipaccess/ipaccess-config.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c
index 1ef8e3eb4..0a9dfc83c 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -108,7 +108,12 @@ static int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa)
return -EIO;
}
- 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);
+ return -EIO;
+ }
ret = connect(bfd->fd, (struct sockaddr *) sa, sizeof(*sa));
if (ret < 0) {