aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ali Polatel <alip@exherbo.org> 2021-02-27 09:13:30 +0100
committerAvatar Ali Polatel <alip@exherbo.org> 2021-02-27 15:55:35 +0100
commita0c9fceedb390cff892327d18372cb2823cfbb7d (patch)
tree258491cba6cf1c1ff0d172ea9aea5ace74c7cfe6
parentb73d0c0d7b2c0b76bc536ab9411018c745fd5b60 (diff)
downloadsydbox-1-a0c9fceedb390cff892327d18372cb2823cfbb7d.tar.gz
sydbox-1-a0c9fceedb390cff892327d18372cb2823cfbb7d.tar.xz
initial support for faccessat2, fix faccessat
Signed-off-by: Ali Polatel <alip@exherbo.org>
-rw-r--r--src/syscall-file.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/syscall-file.c b/src/syscall-file.c
index 56af41c..e54f338 100644
--- a/src/syscall-file.c
+++ b/src/syscall-file.c
@@ -112,7 +112,7 @@ int sys_access(syd_process_t *current)
return check_access(current, &info, mode);
}
-int sys_faccessat(syd_process_t *current)
+static int do_faccessat(syd_process_t *current, bool has_flags)
{
int r;
long mode, flags;
@@ -126,7 +126,7 @@ int sys_faccessat(syd_process_t *current)
return r;
if (!check_access_mode(current, mode))
return 0;
- if ((r = syd_read_argument(current, 3, &flags)) < 0)
+ if (has_flags && (r = syd_read_argument(current, 3, &flags)) < 0)
return r;
init_sysinfo(&info);
@@ -134,12 +134,22 @@ int sys_faccessat(syd_process_t *current)
info.arg_index = 1;
info.safe = true;
info.deny_errno = EACCES;
- if (flags & AT_SYMLINK_NOFOLLOW)
+ if (has_flags && (flags & AT_SYMLINK_NOFOLLOW))
info.rmode |= RPATH_NOFOLLOW;
return check_access(current, &info, mode);
}
+int sys_faccessat(syd_process_t *current)
+{
+ return do_faccessat(current, false);
+}
+
+int sys_faccessat2(syd_process_t *current)
+{
+ return do_faccessat(current, true);
+}
+
/* TODO: Do we need to care about O_PATH? */
static void init_open_info(syd_process_t *current, int flags, struct open_info *info)
{