Commit f0cf401c authored by Simon Stridsberg's avatar Simon Stridsberg Committed by Dridi Boukelmoune

Loop over FDs if close_range fails.

parent 13ae7d9e
...@@ -38,9 +38,7 @@ ...@@ -38,9 +38,7 @@
#include <stdlib.h> // Solaris closefrom(3c) #include <stdlib.h> // Solaris closefrom(3c)
#include <string.h> #include <string.h>
#include <unistd.h> // BSD/Linux close_range(2) #include <unistd.h> // BSD/Linux close_range(2)
#ifdef HAVE_WORKING_CLOSE_RANGE #ifndef HAVE_CLOSEFROM
#elif HAVE_CLOSEFROM
#else
# include <dirent.h> # include <dirent.h>
#endif #endif
...@@ -67,13 +65,14 @@ VSUB_closefrom(int fd) ...@@ -67,13 +65,14 @@ VSUB_closefrom(int fd)
assert(fd >= 0); assert(fd >= 0);
#ifdef HAVE_WORKING_CLOSE_RANGE #ifdef HAVE_CLOSEFROM
AZ(close_range(fd, ~0U, 0));
return;
#elif HAVE_CLOSEFROM
closefrom(fd); closefrom(fd);
return; return;
#else #else
# ifdef HAVE_WORKING_CLOSE_RANGE
if (close_range(fd, ~0U, 0) == 0)
return;
# endif
char buf[128]; char buf[128];
int i, maxfd = 0; int i, maxfd = 0;
DIR *d; DIR *d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment