1#include <fcntl.h> 2#include <unistd.h> 3#include <errno.h> 4#include "test.h" 5 6void t_fdfill(void) 7{ 8 int fd = 1; 9 if (dup(fd) == -1) { 10 if (errno == EMFILE) 11 return; 12 fd = open("/dev/null", O_RDONLY); 13 } 14 while(dup(fd) != -1); 15} 16