diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-07-05 19:11:20 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-07-05 19:11:20 -0400 |
commit | 71a1b65ba926ff9c6db3cb671580b5491db0bd97 (patch) | |
tree | 64914ae4d8748d7665a61a5dd646b07da9b63dbe /stat.c | |
parent | 2bc5a80b3a24487b12bef5ea55a1155652260eff (diff) | |
download | bfs-71a1b65ba926ff9c6db3cb671580b5491db0bd97.tar.xz |
stat: Treat EPERM like ENOSYS for statx()
On some configurations (e.g. old Docker with the default seccomp()
profile), statx() fails with EPERM. Consider this to mean statx() is
unsupported, as EPERM is not a documented error code in normal
operation.
Possible fix for https://github.com/alpinelinux/aports/pull/9277
Diffstat (limited to 'stat.c')
-rw-r--r-- | stat.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -282,7 +282,9 @@ static int bfs_stat_explicit(int at_fd, const char *at_path, int at_flags, enum if (has_statx) { int ret = bfs_statx_impl(at_fd, at_path, at_flags, flags, buf); - if (ret != 0 && errno == ENOSYS) { + // EPERM is commonly returned in a seccomp() sandbox that does + // not allow statx() + if (ret != 0 && (errno == ENOSYS || errno == EPERM)) { has_statx = false; } else { return ret; |