SCK_AcceptConnection(int sock_fd, IPSockAddr *remote_addr)
{
  union sockaddr_all saddr;
  socklen_t saddr_len = sizeof (saddr);
  int conn_fd;

  conn_fd = accept(sock_fd, &saddr.sa, &saddr_len);
  if (conn_fd < 0) {
    DEBUG_LOG("accept() failed : %s", strerror(errno));
    return INVALID_SOCK_FD;
  }

  if (!UTI_FdSetCloexec(conn_fd) || !set_socket_nonblock(conn_fd)) {
    close(conn_fd);
    return INVALID_SOCK_FD;
  }

  SCK_SockaddrToIPSockAddr(&saddr.sa, saddr_len, remote_addr);

  return conn_fd;
}
SCK_AcceptConnection(int sock_fd, IPSockAddr *remote_addr)
{
  union sockaddr_all saddr;
  socklen_t saddr_len = sizeof (saddr);
  int conn_fd;

  conn_fd = accept(sock_fd, &saddr.sa, &saddr_len);
  if (conn_fd < 0) {
    DEBUG_LOG("accept() failed : %s", strerror(errno));
    return INVALID_SOCK_FD;
  }

  if (!UTI_FdSetCloexec(conn_fd) || !set_socket_nonblock(conn_fd)) {
    close(conn_fd);
    return INVALID_SOCK_FD;
  }

  SCK_SockaddrToIPSockAddr(&saddr.sa, saddr_len, remote_addr);

  return conn_fd;
}