]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
added F_CLOSEM, which might work, too
authorAlan T. DeKok <aland@freeradius.org>
Mon, 26 Sep 2016 12:08:04 +0000 (08:08 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 26 Sep 2016 12:08:04 +0000 (08:08 -0400)
src/lib/misc.c

index be630668d367e405a3dbac5f988b806c7bbb096f..de2b50fa9716bb01fb3e4ba2872f55a935582cc7 100644 (file)
@@ -1360,6 +1360,12 @@ int closefrom(int fd)
        int i;
        int maxfd = 256;
 
+#ifdef F_CLOSEM
+       if (fcntl(fd, F_CLOSEM) == 0) {
+               return 0;
+       }
+#endif
+
 #ifdef _SC_OPEN_MAX
        maxfd = sysconf(_SC_OPEN_MAX);
        if (maxfd < 0) {
@@ -1371,8 +1377,6 @@ int closefrom(int fd)
 
        /*
         *      FIXME: return EINTR?
-        *
-        *      Use F_CLOSEM?
         */
        for (i = fd; i < maxfd; i++) {
                close(i);