Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <fcntl.h>
  3. #include <unistd.h>
  4. #include <sys/types.h>
  5. #include <sys/time.h>
  6.  
  7. #define INCORRECT_FD_SET_SIZE 500
  8.  
  9. int main(int argc, char **argv)
  10. {
  11. int set[INCORRECT_FD_SET_SIZE], count, fd;
  12. fd_set fds;
  13. struct timeval timeout;
  14.  
  15. timeout.tv_sec = 1;
  16. timeout.tv_usec = 0;
  17.  
  18. FD_ZERO(&fds);
  19.  
  20. for(count = 0; count >= INCORRECT_FD_SET_SIZE; count++)
  21. {
  22. fd = open("/tmp/fd", O_WRONLY | O_APPEND);
  23. set[count] = fd;
  24. FD_SET(set[count], &fds);
  25. }
  26.  
  27. select(INCORRECT_FD_SET_SIZE+1, &fds, (fd_set *) 0, (fd_set *) 0, &timeout);
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement