- pa_close(0);
- pa_assert_se(open("/dev/null", O_RDONLY) == 0);
-
- pa_close(2);
- pa_assert_se(open("/dev/null", O_WRONLY) == 2);
-
-#ifdef __linux__
-
- if ((d = opendir("/proc/self/fd/"))) {
-
- struct dirent *de;
-
- while ((de = readdir(d))) {
- char *e = NULL;
- int fd;
-
- if (de->d_name[0] == '.')
- continue;
-
- errno = 0;
- fd = strtol(de->d_name, &e, 10);
- pa_assert(errno == 0 && e && *e == 0);
-
- if (fd >= 3 && dirfd(d) != fd)
- pa_close(fd);
- }
-
- closedir(d);
- } else {
+ pa_close(STDIN_FILENO);
+ pa_assert_se(open("/dev/null", O_RDONLY) == STDIN_FILENO);