From: Todd C. Miller Date: Tue, 1 Jun 2004 20:51:56 +0000 (+0000) Subject: Only check /proc/$$/fd if we have the dirfd function/macro. X-Git-Tag: SUDO_1_6_8~92 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cebfa4c0308f410ba6abdecd22e5893b6ec05e7b;p=sudo Only check /proc/$$/fd if we have the dirfd function/macro. --- diff --git a/closefrom.c b/closefrom.c index 3aeb45df4..1f04e9900 100644 --- a/closefrom.c +++ b/closefrom.c @@ -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