Skip to content

Commit 0149360

Browse files
committed
Fix macOS posix_spawn_file_actions_addchdir availability handling
1 parent d8a3e82 commit 0149360

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

ext/standard/proc_open.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,18 @@
4747
#define USE_POSIX_SPAWN
4848

4949
/* The non-_np variant is in macOS 26 (and _np deprecated) */
50+
#if defined(__APPLE__) && defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR) && \
51+
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 260000
52+
#define USE_ADDCHDIR posix_spawn_file_actions_addchdir
53+
#else
54+
#define USE_ADDCHDIR posix_spawn_file_actions_addchdir_np
55+
#endif
56+
5057
static inline int php_spawn_addchdir(
5158
posix_spawn_file_actions_t *factions,
5259
const char *cwd
5360
) {
54-
#if defined(__APPLE__) && defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
55-
if (__builtin_available(macOS 26.0, *)) {
56-
return posix_spawn_file_actions_addchdir(factions, cwd);
57-
} else {
58-
return posix_spawn_file_actions_addchdir_np(factions, cwd);
59-
}
60-
#elif defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
61-
return posix_spawn_file_actions_addchdir(factions, cwd);
62-
#else
63-
return posix_spawn_file_actions_addchdir_np(factions, cwd);
64-
#endif
61+
return USE_ADDCHDIR(factions, cwd);
6562
}
6663

6764
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR(f, d) \

0 commit comments

Comments
 (0)