Przeglądaj źródła

ctl: safety check for closing fd

(cherry picked from commit 24c4f357ecc83ded4c8890ed4440a0252191b0a9)
Daniel-Constantin Mierla 8 lat temu
rodzic
commit
c23c5b426e
2 zmienionych plików z 1 dodań i 2 usunięć
  1. 1 1
      src/modules/ctl/ctl.c
  2. 0 1
      src/modules/ctl/ctrl_socks.c

+ 1 - 1
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);

+ 0 - 1
src/modules/ctl/ctrl_socks.c

@@ -133,7 +133,6 @@ find_port:
 	
 end:
 	/* fix all the stuff */
-	if (name==0) goto error;
 	if (proto==UNKNOWN_SOCK){
 		/* try to guess */
 		if (port_str){