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