From: Szabolcs Nagy Date: Sat, 20 Jul 2013 21:05:07 +0000 (+0000) Subject: fix t_fdfill so it does not use much kernel side resources X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=2456ff49ea7ea4b5e88d70f967cf477d005519d8;p=libc-test fix t_fdfill so it does not use much kernel side resources --- diff --git a/src/common/fdfill.c b/src/common/fdfill.c index da744c1..6419e93 100644 --- a/src/common/fdfill.c +++ b/src/common/fdfill.c @@ -1,9 +1,15 @@ +#include #include +#include #include "test.h" void t_fdfill(void) { - int fd[2]; - while (pipe(fd) == 0); - dup(0); + int fd = 1; + if (dup(fd) == -1) { + if (errno == EMFILE) + return; + fd = open("/dev/null", O_RDONLY); + } + while(dup(fd) != -1); }