blob: 4d080726f8ffa30c9ba5ddb12065801bd140e4a5 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From 95508f06f13604ed96f28d18eb1670ea1ed02063 Mon Sep 17 00:00:00 2001
Patrick Williams0ca19cc2021-08-16 14:03:13 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 6 Mar 2021 14:48:56 -0800
4Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns
5 EPERM
6
7Fedora-specific workaround for systemd-nspawn
8
9Upstream-Status: Inappropriate [Distro Specific]
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 sysdeps/unix/sysv/linux/faccessat.c | 6 +++++-
14 1 file changed, 5 insertions(+), 1 deletion(-)
15
16diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
Patrick Williams92b42cb2022-09-03 06:53:57 -050017index 1378bb2db8..19f2044172 100644
Patrick Williams0ca19cc2021-08-16 14:03:13 -050018--- a/sysdeps/unix/sysv/linux/faccessat.c
19+++ b/sysdeps/unix/sysv/linux/faccessat.c
20@@ -30,7 +30,11 @@ __faccessat (int fd, const char *file, int mode, int flag)
21 #if __ASSUME_FACCESSAT2
22 return ret;
23 #else
24- if (ret == 0 || errno != ENOSYS)
25+ /* Fedora-specific workaround:
26+ As a workround for a broken systemd-nspawn that returns
27+ EPERM when a syscall is not allowed instead of ENOSYS
28+ we must check for EPERM here and fall back to faccessat. */
29+ if (ret == 0 || !(errno == ENOSYS || errno == EPERM))
30 return ret;
31
32 if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS))