1
0
mirror of https://github.com/falk-werner/webfuse synced 2026-03-02 03:40:24 +00:00

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

This commit is contained in:
Falk Werner
2024-01-08 17:52:05 +01:00
committed by Falk Werner
parent 7fa9dbefe3
commit 9644d46dac
2 changed files with 33 additions and 0 deletions

View File

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