[sr-dev] git:master:0225f89a: core: pt - check to avoid two times closing unneeded sockets

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 18 09:16:20 CEST 2017


Module: kamailio
Branch: master
Commit: 0225f89a658172d0652e0da14549ee03653114d2
URL: https://github.com/kamailio/kamailio/commit/0225f89a658172d0652e0da14549ee03653114d2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-18T09:11:12+02:00

core: pt - check to avoid two times closing unneeded sockets

---

Modified: src/core/pt.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0225f89a658172d0652e0da14549ee03653114d2.diff
Patch: https://github.com/kamailio/kamailio/commit/0225f89a658172d0652e0da14549ee03653114d2.patch

---

diff --git a/src/core/pt.c b/src/core/pt.c
index 930d73093f..1944da6207 100644
--- a/src/core/pt.c
+++ b/src/core/pt.c
@@ -210,14 +210,14 @@ int close_extra_socks(int child_id, int proc_no)
 		/* close all listen sockets (needed only in tcp_main */
 		if (!tcp_disable){
 			for(si=tcp_listen; si; si=si->next){
-				close(si->socket);
+				if(si->socket>=0) close(si->socket);
 				/* safe to change since this is a per process copy */
 				si->socket=-1;
 			}
 #ifdef USE_TLS
 			if (!tls_disable){
 				for(si=tls_listen; si; si=si->next){
-					close(si->socket);
+					if(si->socket>=0) close(si->socket);
 					/* safe to change since this is a per process copy */
 					si->socket=-1;
 				}




More information about the sr-dev mailing list