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

pull/115/head
Falk Werner 4 months ago
parent 7fa9dbefe3
commit 3d5e635cd0
No known key found for this signature in database

@ -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