From c8ab9926132085f2daf6b949cafda43378d50fb5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 28 Feb 2024 13:00:54 -0500 Subject: stat: Use errno_is_like(ENOSYS) for EPERM kludge --- src/bfstd.c | 4 ++++ src/stat.c | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/bfstd.c b/src/bfstd.c index d19049f..ce4aa49 100644 --- a/src/bfstd.c +++ b/src/bfstd.c @@ -45,6 +45,10 @@ bool error_is_like(int error, int category) { case ENOENT: return error == ENOTDIR; + case ENOSYS: + // https://github.com/opencontainers/runc/issues/2151 + return errno == EPERM; + #if __DragonFly__ // https://twitter.com/tavianator/status/1742991411203485713 case ENAMETOOLONG: diff --git a/src/stat.c b/src/stat.c index 36222cb..2f2743b 100644 --- a/src/stat.c +++ b/src/stat.c @@ -253,9 +253,7 @@ static int bfs_stat_explicit(int at_fd, const char *at_path, int at_flags, struc if (load(&has_statx, relaxed)) { int ret = bfs_statx_impl(at_fd, at_path, at_flags, buf); - // EPERM is commonly returned in a seccomp() sandbox that does - // not allow statx() - if (ret != 0 && (errno == ENOSYS || errno == EPERM)) { + if (ret != 0 && errno_is_like(ENOSYS)) { store(&has_statx, false, relaxed); } else { return ret; -- cgit v1.2.3