]> granicus.if.org Git - sudo/commitdiff
Only check /proc/$$/fd if we have the dirfd function/macro.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jun 2004 20:51:56 +0000 (20:51 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jun 2004 20:51:56 +0000 (20:51 +0000)
closefrom.c

index 3aeb45df4deb659441a92af1d65f1ef3f87faf33..1f04e9900fab7dd6fe454bbc5fe8e2955a3fd01c 100644 (file)
@@ -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