rem: int sock_listen, sock_accept; debug_v("core_tcp_listen(local_host=%p, local_port=%hu, timeout=%d)", (void *)local_host, local_port, timeout);
add: int sock_listen, sock_accept, timeout = ncsock->timeout; debug_v("core_tcp_listen(ncsock=%p)", (void *)ncsock);
context: int core_tcp_listen(struct in_addr *local_host, unsigned short local_port, int timeout){  int sock_listen, sock_accept;  debug_v("core_tcp_listen(local_host=%p, local_port=%hu, timeout=%d)",	  (void *)local_host, local_port, timeout);  sock_listen = netcat_socket_new_listen(local_host, local_port);  if (sock_listen < 0)    ncprint(NCPRINT_ERROR | NCPRINT_EXIT, "Couldn't setup listen socket (err=%d)",	    sock_listen);  while (TRUE) {    struct sockaddr_in my_addr;    unsigned int my_len = sizeof(my_addr);	/* this *IS* socklen_t */    sock_accept = netcat_socket_accept(sock_listen, timeout);    /* reset the timeout to the "use remaining time" value (see network.c file)       if it exited with timeout we also return this function, so losing the       original value is not a bad thing. */    timeout = -1;    /* failures in netcat_socket_accept() cause this function to return */    if (sock_accept < 0)      return -1;    /* FIXME: i want a library function like netcat_peername() that fetches it       and resolves with netcat_resolvehost().       i also must check _resolvehost() */    getpeername(sock_accept, (struct sockaddr *)&my_addr, &my_len);    /* if a remote address (and optionally some ports) have been specified       AND we are NOT in tunnnel mode, we assume it as the only ip and port       that it is allowed to connect to this socket */    if (!opt_tunnel) {      if ((remote_host.iaddrs[0].s_addr && memcmp(&remote_host.iaddrs[0],	   &my_addr.sin_addr, sizeof(remote_host.iaddrs[0]))) ||	  (netcat_flag_count() && !netcat_flag_get(ntohs(my_addr.sin_port)))) {	ncprint(NCPRINT_VERB2, _("Unwanted connection from %s:%hu (refused)"),		netcat_inet_ntop(&my_addr.sin_addr), ntohs(my_addr.sin_port));	goto refuse;      }    }    ncprint(NCPRINT_VERB1, _("Connection from %s:%hu"),	    netcat_inet_ntop(&my_addr.sin_addr), ntohs(my_addr.sin_port));    /* with zero I/O mode we don't really accept any connection */    if (opt_zero)      goto refuse;    /* we have got our socket, now exit the loop */    break; refuse:    shutdown(sock_accept, 2);    close(sock_accept);    continue;  }			/* end of infinite accepting loop */  /* we don't need a listening socket anymore */  close(sock_listen);  return sock_accept;}				/* end of core_tcp_listen() */