diff --git a/lib/libvarnish/vsub.c b/lib/libvarnish/vsub.c index 27caec46d04..232a975c3ca 100644 --- a/lib/libvarnish/vsub.c +++ b/lib/libvarnish/vsub.c @@ -38,10 +38,8 @@ #include // Solaris closefrom(3c) #include #include // BSD/Linux close_range(2) -#ifdef HAVE_WORKING_CLOSE_RANGE -#elif HAVE_CLOSEFROM -#else -# include +#ifndef HAVE_CLOSEFROM +#include #endif #include "vdef.h" @@ -67,13 +65,14 @@ VSUB_closefrom(int fd) assert(fd >= 0); -#ifdef HAVE_WORKING_CLOSE_RANGE - AZ(close_range(fd, ~0U, 0)); - return; -#elif HAVE_CLOSEFROM +#ifdef HAVE_CLOSEFROM closefrom(fd); return; #else +#ifdef HAVE_WORKING_CLOSE_RANGE + if (close_range(fd, ~0U, 0) == 0) + return; +#endif char buf[128]; int i, maxfd = 0; DIR *d;