rem: debug_v("core_tcp_connect(ncsock=%p)", (void *)ncsock);
add: debug_v(("core_tcp_connect(ncsock=%p)", (void *)ncsock));
context: static int core_tcp_connect(nc_sock_t *ncsock){  int ret, sock, timeout = ncsock->timeout;  struct timeval timest;  fd_set outs;  debug_v("core_tcp_connect(ncsock=%p)", (void *)ncsock);  /* since we are nonblocking now, we could start as many connections as we     want but it's not a great idea connecting more than one host at time.     Also don't specify the local address if it's not really needed, so we can     avoid one bind(2) call. */  sock = netcat_socket_new_connect(PF_INET, SOCK_STREAM,	&ncsock->host.iaddrs[0], ncsock->port.netnum,	(ncsock->local_host.iaddrs[0].s_addr ? &ncsock->local_host.iaddrs[0] :	NULL), ncsock->local_port.netnum);  if (sock < 0)    ncprint(NCPRINT_ERROR | NCPRINT_EXIT, "Couldn't create connection (err=%d): %s",	    sock, strerror(errno));  /* initialize select()'s variables */  FD_ZERO(&outs);  FD_SET(sock, &outs);  timest.tv_sec = timeout;  timest.tv_usec = 0;  ret = select(sock + 1, NULL, &outs, NULL, (timeout > 0 ? &timest : NULL));  if (ret > 0) {    int ret, get_ret;    unsigned int get_len = sizeof(get_ret);	/* socklen_t */    /* ok, select([single]), so sock must have triggered this */    assert(FD_ISSET(sock, &outs));    /* fetch the errors of the socket and handle system request errors */    ret = getsockopt(sock, SOL_SOCKET, SO_ERROR, &get_ret, &get_len);    if (ret < 0)      ncprint(NCPRINT_ERROR | NCPRINT_EXIT, "Critical system request failed: %s",	      strerror(errno));    /* POSIX says that SO_ERROR expects an int, so my_len must be untouched */    assert(get_len == sizeof(get_ret));    /* FIXME: the error Broken Pipe should probably not stop here */    debug_v("Connection returned errcode=%d (%s)", get_ret, strerror(get_ret));    if (get_ret > 0) {      char tmp;      /* Ok, select() returned a write event for this socket AND getsockopt()         said that some error happened.  This mean that EOF is expected. */      ret = read(sock, &tmp, 1);      assert(ret == 0);      /* FIXME: see the TODO entry about false error detection */      shutdown(sock, 2);      close(sock);      ncsock->fd = -1;      errno = get_ret;		/* value returned by getsockopt(SO_ERROR) */      return -1;    }    /* everything went fine, we have the socket */    ncprint(NCPRINT_VERB1, _("%s open"), netcat_strid(&ncsock->host,						      &ncsock->port));    return sock;  }  else if (ret) {    /* Terminated by a signal. Silently exit */    if (errno == EINTR)      exit(EXIT_FAILURE);    /* The error seems to be a little worse */    ncprint(NCPRINT_ERROR | NCPRINT_EXIT, "Critical system request failed: %s",	    strerror(errno));  }  /* select returned 0, this means connection timed out for our timing     directives (in fact the socket has a longer timeout usually, so we need     to abort the connection try, set the proper errno and return */  shutdown(sock, 2);  close(sock);  errno = ETIMEDOUT;  return -1;}				/* end of core_tcp_connect() */