Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From 95508f06f13604ed96f28d18eb1670ea1ed02063 Mon Sep 17 00:00:00 2001 |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 6 Mar 2021 14:48:56 -0800 |
| 4 | Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns |
| 5 | EPERM |
| 6 | |
| 7 | Fedora-specific workaround for systemd-nspawn |
| 8 | |
| 9 | Upstream-Status: Inappropriate [Distro Specific] |
| 10 | |
| 11 | Signed-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 | |
| 16 | diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 17 | index 1378bb2db8..19f2044172 100644 |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 18 | --- 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)) |