C/ajinject.c
/* aj_setnonblock accepts the airjack_data structure with an open socket, and a
   flag to specify whether or not to go nonblock. 
   This code coincidentally resembles similar libpcap functions.  No, really. */
aj_setnonblock accepts the airjack_data structure with an open socket, and a
flag to specify whether or not to go nonblock.
This code coincidentally resembles similar libpcap functions.  No, really.
aj_setnonblock accepts the airjack_data structure with an open socket and a flag to specify whether or not to go nonblock . This code coincidentally resembles similar libpcap functions . No really .
int aj_setnonblock(char *ifname, int nonblock) {
    int fdflags;
    int sock;
    if((sock = aj_getsocket(ifname)) < 0) {
        perror("aj_getsocket");
        close(sock);
        return(-1);
    }
    fdflags = fcntl(sock, F_GETFL, 0);
    if (fdflags == -1) {
                perror("fcntl[F_GETFL]");
        close(sock);
        return (-1);
    }
    if (nonblock)
        fdflags |= O_NONBLOCK;
    else
        fdflags &= ~O_NONBLOCK;
    if (fcntl(sock, F_SETFL, fdflags) == -1) {
                perror("fcntl[F_SETFL]");
        close(sock);
        return (-1);
    }
    close(sock);
    return (0);
}
int aj_setnonblock ( char * ifname , int nonblock ) { int fdflags ; int sock ; if ( ( sock = aj_getsocket ( ifname ) ) < 0 ) { perror ( " " ) ; close ( sock ) ; return ( -1 ) ; } fdflags = fcntl ( sock , F_GETFL , 0 ) ; if ( fdflags == -1 ) { perror ( " " ) ; close ( sock ) ; return ( -1 ) ; } if ( nonblock ) fdflags |= O_NONBLOCK ; else fdflags &= ~ O_NONBLOCK ; if ( fcntl ( sock , F_SETFL , fdflags ) == -1 ) { perror ( " " ) ; close ( sock ) ; return ( -1 ) ; } close ( sock ) ; return ( 0 ) ; }
aj_setnonblock accepts the airjack_data structure with an open socket, and a
flag to specify whether or not to go nonblock.
aj_setnonblock accepts the airjack_data structure with an open socket and a flag to specify whether or not to go nonblock .