Only check /proc/$$/fd if we have the dirfd function/macro.
This commit is contained in:
@@ -59,6 +59,7 @@ closefrom(lowfd)
|
|||||||
int lowfd;
|
int lowfd;
|
||||||
{
|
{
|
||||||
long fd, maxfd;
|
long fd, maxfd;
|
||||||
|
#ifdef HAVE_DIRFD
|
||||||
char fdpath[PATH_MAX], *endp;
|
char fdpath[PATH_MAX], *endp;
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
@@ -73,8 +74,10 @@ closefrom(lowfd)
|
|||||||
fd >= 0 && fd < INT_MAX && fd >= lowfd && fd != dirfd(dirp))
|
fd >= 0 && fd < INT_MAX && fd >= lowfd && fd != dirfd(dirp))
|
||||||
(void) close((int) fd);
|
(void) close((int) fd);
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
(void) closedir(dirp);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Fall back on sysconf() or getdtablesize(). We avoid checking
|
* Fall back on sysconf() or getdtablesize(). We avoid checking
|
||||||
* resource limits since it is possible to open a file descriptor
|
* resource limits since it is possible to open a file descriptor
|
||||||
|
Reference in New Issue
Block a user