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:
17
include/crucible/openat2.h
Normal file
17
include/crucible/openat2.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef CRUCIBLE_OPENAT2_H
|
||||
#define CRUCIBLE_OPENAT2_H
|
||||
|
||||
#include <linux/openat2.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
/// Weak symbol to support libc with no syscall wrapper
|
||||
int openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) throw();
|
||||
|
||||
};
|
||||
|
||||
#endif // CRUCIBLE_OPENAT2_H
|
Reference in New Issue
Block a user