This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
dexter gerrit-no-reply at lists.osmocom.orgdexter has uploaded this change for review. ( https://gerrit.osmocom.org/10288
Change subject: socket: check return code of setsockopt
......................................................................
socket: check return code of setsockopt
the return code of the last setsockopt() call in osmo_sock_init() is not
checked. Since all other calls to setsockopt are checked, lets check
this one as well.
- check return code of setsockopt() and close the socket on failure
Change-Id: I96dbccc3bcff35bf39979dbe0c44aadc8ce20c83
---
M src/socket.c
1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/88/10288/1
diff --git a/src/socket.c b/src/socket.c
index dc5590c..0a4e34c 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -373,7 +373,14 @@
return -ENODEV;
}
- setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ rc = setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ if (rc < 0) {
+ LOGP(DLGLOBAL, LOGL_ERROR,
+ "cannot setsockopt socket: %s:%u: %s\n", host, port,
+ strerror(errno));
+ close(sfd);
+ sfd = -1;
+ }
rc = osmo_sock_init_tail(sfd, type, flags);
if (rc < 0) {
--
To view, visit https://gerrit.osmocom.org/10288
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I96dbccc3bcff35bf39979dbe0c44aadc8ce20c83
Gerrit-Change-Number: 10288
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180801/fa62d844/attachment.htm>