add shim for closefrom to support systems without that function (glibc before 2.34)

pull/116/head
Falk Werner 4 months ago committed by Falk Werner
parent 7fa9dbefe3
commit 9644d46dac

@ -4,6 +4,22 @@
#include <sys/wait.h>
#include <fcntl.h>
#ifndef closefrom
namespace
{
void closefrom(int fd)
{
int const max_fd = sysconf(_SC_OPEN_MAX);
for(int i = fd; i < max_fd; i++)
{
close(i);
}
}
}
#endif
namespace webfuse
{

@ -9,6 +9,23 @@
#include <stdexcept>
#ifndef closefrom
namespace
{
void closefrom(int fd)
{
int const max_fd = sysconf(_SC_OPEN_MAX);
for(int i = fd; i < max_fd; i++)
{
close(i);
}
}
}
#endif
namespace webfuse
{

Loading…
Cancel
Save