Avoid potential libdispatch crash when we close its fds. --- compat/closefrom.c.orig +++ compat/closefrom.c @@ -27,6 +27,7 @@ #include /* for */ #include /* getrlimit() */ #include +#include #include /* errno */ #include /* FD_SETSIZE */ @@ -74,7 +75,11 @@ } while ((unsigned)fd < lim.rlim_max) +#ifdef __APPLE__ + if (fcntl (fd++, F_SETFD, FD_CLOEXEC) != -1) +#else if (close (fd++) == 0) +#endif found++; if (found == 0)