1#include <stdio.h>
2#include <stdlib.h>
3#include <sys/resource.h>
4#include <unistd.h>
5
6int main(int argc, char **argv)
7{
8  struct rlimit lim;
9  int fd;
10
11  getrlimit(RLIMIT_NOFILE, &lim);
12
13  for ( fd = 3; fd < lim.rlim_cur; fd++ )
14    close( fd );
15
16  exit( 0 );
17}
18