Skip to content

Instantly share code, notes, and snippets.

@robbmanes
Created February 5, 2016 19:01
Show Gist options
  • Save robbmanes/f49c9abbc6e2fab77209 to your computer and use it in GitHub Desktop.
Save robbmanes/f49c9abbc6e2fab77209 to your computer and use it in GitHub Desktop.
#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