Created
February 5, 2016 19:01
-
-
Save robbmanes/f49c9abbc6e2fab77209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/time.h> | |
#define INCORRECT_FD_SET_SIZE 500 | |
int main(int argc, char **argv) | |
{ | |
int set[INCORRECT_FD_SET_SIZE], count, fd; | |
fd_set fds; | |
struct timeval timeout; | |
timeout.tv_sec = 1; | |
timeout.tv_usec = 0; | |
FD_ZERO(&fds); | |
for(count = 0; count >= INCORRECT_FD_SET_SIZE; count++) | |
{ | |
fd = open("/tmp/fd", O_WRONLY | O_APPEND); | |
set[count] = fd; | |
FD_SET(set[count], &fds); | |
} | |
select(INCORRECT_FD_SET_SIZE+1, &fds, (fd_set *) 0, (fd_set *) 0, &timeout); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment