summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
blob: 4d080726f8ffa30c9ba5ddb12065801bd140e4a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 95508f06f13604ed96f28d18eb1670ea1ed02063 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 6 Mar 2021 14:48:56 -0800
Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns
 EPERM

Fedora-specific workaround for systemd-nspawn

Upstream-Status: Inappropriate [Distro Specific]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 sysdeps/unix/sysv/linux/faccessat.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 1378bb2db8..19f2044172 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -30,7 +30,11 @@ __faccessat (int fd, const char *file, int mode, int flag)
 #if __ASSUME_FACCESSAT2
   return ret;
 #else
-  if (ret == 0 || errno != ENOSYS)
+  /* Fedora-specific workaround:
+     As a workround for a broken systemd-nspawn that returns
+     EPERM when a syscall is not allowed instead of ENOSYS
+     we must check for EPERM here and fall back to faccessat.  */
+  if (ret == 0 || !(errno == ENOSYS || errno == EPERM))
     return ret;
 
   if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS))