Module: kamailio
Branch: master
Commit: 39f09877e650d66e820ca7eb0d61416818d174fc
URL:
https://github.com/kamailio/kamailio/commit/39f09877e650d66e820ca7eb0d61416…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-06-12T17:16:53+02:00
cdp: check setsockopt() return code
---
Modified: src/modules/cdp/tcp_accept.c
---
Diff:
https://github.com/kamailio/kamailio/commit/39f09877e650d66e820ca7eb0d61416…
Patch:
https://github.com/kamailio/kamailio/commit/39f09877e650d66e820ca7eb0d61416…
---
diff --git a/src/modules/cdp/tcp_accept.c b/src/modules/cdp/tcp_accept.c
index 968a245eb6a..43ff83c14a2 100644
--- a/src/modules/cdp/tcp_accept.c
+++ b/src/modules/cdp/tcp_accept.c
@@ -139,8 +139,11 @@ int create_socket(
goto error;
}
option = 1;
- setsockopt(
- server_sock, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
+ if(setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &option,
+ sizeof(option))
+ < 0) {
+ LM_WARN("failed to set SO_REUSEADDR option for server socket\n");
+ }
if(bind(server_sock, ainfo->ai_addr, ainfo->ai_addrlen) == -1) {
LM_ERR("create_socket(): error binding on %s port %s >"