[sr-dev] git:master:24c4f357: ctl: safety check for closing fd

Daniel-Constantin Mierla miconda at gmail.com
Sun Jul 30 18:34:41 CEST 2017


Module: kamailio
Branch: master
Commit: 24c4f357ecc83ded4c8890ed4440a0252191b0a9
URL: https://github.com/kamailio/kamailio/commit/24c4f357ecc83ded4c8890ed4440a0252191b0a9

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-30T18:33:55+02:00

ctl: safety check for closing fd

---

Modified: src/modules/ctl/ctl.c
Modified: src/modules/ctl/ctrl_socks.c

---

Diff:  https://github.com/kamailio/kamailio/commit/24c4f357ecc83ded4c8890ed4440a0252191b0a9.diff
Patch: https://github.com/kamailio/kamailio/commit/24c4f357ecc83ded4c8890ed4440a0252191b0a9.patch

---

diff --git a/src/modules/ctl/ctl.c b/src/modules/ctl/ctl.c
index 2126a00ac7..6f627dcb64 100644
--- a/src/modules/ctl/ctl.c
+++ b/src/modules/ctl/ctl.c
@@ -376,7 +376,7 @@ static void mod_destroy(void)
 		switch(cs->transport){
 			case UNIXS_SOCK:
 			case UNIXD_SOCK:
-				close(cs->fd);
+				if(cs->fd>=0) close(cs->fd);
 				cs->fd=-1;
 				if (cs->write_fd!=-1){
 					close(cs->write_fd);
diff --git a/src/modules/ctl/ctrl_socks.c b/src/modules/ctl/ctrl_socks.c
index 1538346206..9e800a907b 100644
--- a/src/modules/ctl/ctrl_socks.c
+++ b/src/modules/ctl/ctrl_socks.c
@@ -133,7 +133,6 @@ struct id_list* parse_listen_id(char* l, int len, enum socket_protos def)
 	
 end:
 	/* fix all the stuff */
-	if (name==0) goto error;
 	if (proto==UNKNOWN_SOCK){
 		/* try to guess */
 		if (port_str){




More information about the sr-dev mailing list