Skip to content

Commit a0a142a

Browse files
marcpruxjakepetroules
authored andcommitted
Merge __ANDROID__ with __GLIBC__ and __OpenBSD__ checks for posix_spawn_file_actions_addchdir_polyfill
1 parent 308d176 commit a0a142a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/Basic/Subprocess.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,19 @@ int pthread_fchdir_np(int fd)
7979
// Implementation mostly copied from _CFPosixSpawnFileActionsChdir in swift-corelibs-foundation
8080
static int posix_spawn_file_actions_addchdir_polyfill(posix_spawn_file_actions_t * __restrict file_actions,
8181
const char * __restrict path) {
82-
#if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29)
82+
#if (defined(__GLIBC__) && !__GLIBC_PREREQ(2, 29)) || (defined(__OpenBSD__)) || (defined(__ANDROID__) && __ANDROID_API__ < 34)
8383
// Glibc versions prior to 2.29 don't support posix_spawn_file_actions_addchdir_np, impacting:
8484
// - Amazon Linux 2 (EoL mid-2025)
85+
// Currently missing as of:
86+
// - OpenBSD 7.5 (April 2024)
87+
// - Android <= 14
8588
return ENOSYS;
8689
#elif defined(__APPLE__) && defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
8790
// Conditionally available on macOS if building with a deployment target older than 10.15
8891
if (__builtin_available(macOS 10.15, *)) {
8992
return posix_spawn_file_actions_addchdir_np(file_actions, path);
9093
}
9194
return ENOSYS;
92-
#elif defined(__OpenBSD__)
93-
// Currently missing as of:
94-
// - OpenBSD 7.5 (April 2024)
95-
return ENOSYS;
9695
#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || (defined(__ANDROID__) && __ANDROID_API__ >= 34) || defined(__musl__)
9796
// Pre-standard posix_spawn_file_actions_addchdir_np version available in:
9897
// - Solaris 11.3 (October 2015)
@@ -102,9 +101,6 @@ static int posix_spawn_file_actions_addchdir_polyfill(posix_spawn_file_actions_t
102101
// - FreeBSD 13.1 (May 2022)
103102
// - Android 14 (October 2023)
104103
return posix_spawn_file_actions_addchdir_np((posix_spawn_file_actions_t *)file_actions, path);
105-
#elif defined(__ANDROID__) && __ANDROID_API__ < 34
106-
// - Android < 14
107-
return ENOSYS;
108104
#else
109105
// Standardized posix_spawn_file_actions_addchdir version (POSIX.1-2024, June 2024) available in:
110106
// - Solaris 11.4 (August 2018)

0 commit comments

Comments
 (0)