server/sock.c
/* accepts a socket and inits it */
accepts a socket and inits it
accepts a socket and inits it
static int accept_new_fd( struct sock *sock )
{
    int acceptfd;
    struct sockaddr saddr;
    socklen_t slen = sizeof(saddr);
    acceptfd = accept( get_unix_fd(sock->fd), &saddr, &slen);
    if (acceptfd == -1)
    {
        sock_set_error();
        return acceptfd;
    }
    fcntl(acceptfd, F_SETFL, O_NONBLOCK); 
    return acceptfd;
}
static int accept_new_fd ( struct sock * sock ) { int acceptfd ; struct sockaddr saddr ; socklen_t slen = sizeof ( saddr ) ; acceptfd = accept ( get_unix_fd ( sock -> fd ) , & saddr , & slen ) ; if ( acceptfd == -1 ) { sock_set_error ( ) ; return acceptfd ; } fcntl ( acceptfd , F_SETFL , O_NONBLOCK ) ; return acceptfd ; }
accepts a socket and inits it
accepts a socket and inits it
/* Try to accept(2). We can't be safe that this an already connected socket
     * or that accept() is allowed on it. In those cases we will get -1/errno
     * return.
     */ /* make socket nonblocking */