mirror of
https://github.com/Zygo/bees.git
synced 2025-06-15 17:26:15 +02:00
openat2: create a weak syscall wrapper for it
openat2 allows closing more TOCTOU holes, but we can only use it when the kernel supports it. This should disappear seamlessly when libc implements the function. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -14,6 +14,7 @@ CRUCIBLE_OBJS = \
|
||||
fs.o \
|
||||
multilock.o \
|
||||
ntoa.o \
|
||||
openat2.o \
|
||||
path.o \
|
||||
process.o \
|
||||
string.o \
|
||||
|
13
lib/openat2.cc
Normal file
13
lib/openat2.cc
Normal file
@ -0,0 +1,13 @@
|
||||
#include "crucible/openat2.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
int
|
||||
__attribute__((weak))
|
||||
openat2(int const dirfd, const char *const pathname, struct open_how *const how, size_t const size)
|
||||
throw()
|
||||
{
|
||||
return syscall(SYS_openat2, dirfd, pathname, how, size);
|
||||
}
|
||||
|
||||
};
|
Reference in New Issue
Block a user