rem: close(server_sock4);
add: if (server_sock4!=-1) close(server_sock4);
context: int create_socks(unsigned int *socks){	struct ip_addr servip;	union sockaddr_union servaddr;	unsigned int server_sock4;#ifdef USE_IPV6	unsigned int server_sock6;	unsigned int bind_retest;#endif	unsigned int option;	server_sock4 = -1;#ifdef USE_IPV6	server_sock6 = -1;	bind_retest = 0;	if (disable_ipv6) goto do_bind4; /* skip ipv6 binding part*/do_bind6:	LOG(L_INFO,"INFO:init_tcp_shell: doing socket and bind for IPv6...\n");	/* create the listening socket fpr IPv6 */	if ((server_sock6 = socket(AF_INET6, SOCK_STREAM, 0)) == -1) {		LOG(L_ERR,"ERROR:init_tcp_shell: error creating server socket IPv6:"			" %s\n",strerror(errno));		goto error;	}	// TO DO: what was this one good for?	option = 1;	setsockopt(server_sock6,SOL_SOCKET,SO_REUSEADDR,&option,sizeof(option));	memset( &servip, 0, sizeof(servip) );	servip.af = AF_INET6;	servip.len = 16;	memcpy( &servip.u.addr, &in6addr_any, servip.len);	init_su( &servaddr, &servip, htons(listen_port));	if ( (bind( server_sock6, (struct sockaddr*)&servaddr,	sockaddru_len(servaddr)))==-1) {		LOG(L_ERR,"ERROR:init_tcp_shell: error binding server socket IPv6:"			" %s\n",strerror(errno));		goto error;	}	/* IMPORTANT: I have to do listen here to be able to ketch an AAIU on IPv4;	 * bind is not sufficient because of the SO_REUSEADDR option */	if ((listen( server_sock6, 4)) == -1) {		LOG(L_ERR,"ERROR:init_tcp_shell: error listening on server socket "			"IPv6: %s\n",strerror(errno));		goto error;	}	if (bind_retest)		goto bind_done;do_bind4:#endif	LOG(L_INFO,"INFO:init_tcp_shell: doing socket and bind for IPv4...\n");	/* create the listening socket fpr IPv4 */	if ((server_sock4 = socket(AF_INET, SOCK_STREAM, 0)) == -1) {		LOG(L_ERR,"ERROR:init_tcp_shell: error creating server socket IPv4:"			" %s\n",strerror(errno));		goto error;	}	// TO DO: what was this one good for?	option = 1;	setsockopt(server_sock4,SOL_SOCKET,SO_REUSEADDR,&option,sizeof(option));	memset( &servip, 0, sizeof(servip) );	servip.af = AF_INET;	servip.len = 4;	servip.u.addr32[0] = INADDR_ANY;	init_su( &servaddr, &servip, htons(listen_port));	if ((bind( server_sock4, (struct sockaddr*)&servaddr,	sockaddru_len(servaddr)))==-1 ) {#ifdef USE_IPV6		if (!disable_ipv6){			if (errno==ADDRESS_ALREADY_IN_USE && !bind_retest) {				/* I'm doing bind4 for the first time */				LOG(L_WARN,"WARNING:init_tcp_shell: got AAIU for IPv4 with"						" IPv6 on -> close IPv6 and retry\n");				close( server_sock6 );				server_sock6 = -1;				bind_retest = 1;				goto do_bind4;			}		}#endif		LOG(L_ERR,"ERROR:init_tcp_shell: error binding server socket IPv4:"			" %s\n",strerror(errno));		goto error;	}#ifdef USE_IPV6	else {		if (!disable_ipv6){			if (bind_retest) {				/* if a manage to re-bind4 (after an AAIU) with bind6 disable,				 * means the OS does automaticlly bind4 when bind6; in this 				 * case I will disable the bind4 and re-bind6 */				LOG(L_INFO,"INFO:init_tcp_shell: IPv4 bind succeded on re-"					"testing without IPv6 -> close IPv4 and bind only IPv6\n");				close( server_sock4 );				server_sock4 = -1;				goto do_bind6;			} else {				LOG(L_INFO,"INFO:init_tcp_shell: bind for IPv4 succeded along"					" with bind IPv6 -> keep them both\n");			}		}	}#endif	/* binding part done -> do listen */#ifdef USE_IPV6bind_done:	if (server_sock4!=-1) {#endif	/* IPv4 sock */	if ((listen( server_sock4, 4)) == -1) {		LOG(L_ERR,"ERROR:init_tcp_shell: error listening on server socket "			"IPv4: %s\n",strerror(errno) );		goto error;	}#ifdef USE_IPV6	}#endif	/* success */	socks[0] = server_sock4;#ifdef USE_IPV6	socks[1] = server_sock6;#endif	return 1;error:	close(server_sock4);#ifdef USE_IPV6	close(server_sock6);#endif	return -1;}