Skip to content

Commit f1e3800

Browse files
committed
Fix macOS posix_spawn_file_actions_addchdir availability handling
1 parent e189414 commit f1e3800

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

ext/standard/proc_open.c

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/*
22
+----------------------------------------------------------------------+
3-
| Copyright (c) The PHP Group |
3+
| Copyright © The PHP Group and Contributors. |
44
+----------------------------------------------------------------------+
5-
| This source file is subject to version 3.01 of the PHP license, |
6-
| that is bundled with this package in the file LICENSE, and is |
7-
| available through the world-wide-web at the following url: |
8-
| https://www.php.net/license/3_01.txt |
9-
| If you did not receive a copy of the PHP license and are unable to |
10-
| obtain it through the world-wide-web, please send a note to |
11-
| license@php.net so we can mail you a copy immediately. |
5+
| This source file is subject to the Modified BSD License that is |
6+
| bundled with this package in the file LICENSE, and is available |
7+
| through the World Wide Web at <https://www.php.net/license/>. |
8+
| |
9+
| SPDX-License-Identifier: BSD-3-Clause |
1210
+----------------------------------------------------------------------+
1311
| Author: Wez Furlong <wez@thebrainroom.com> |
1412
+----------------------------------------------------------------------+
@@ -44,29 +42,23 @@
4442
* to be really buggy.
4543
*/
4644
#include <spawn.h>
45+
#ifdef __APPLE__
46+
#include <AvailabilityMacros.h>
47+
#endif
4748
#define USE_POSIX_SPAWN
4849

4950
/* The non-_np variant is in macOS 26 (and _np deprecated) */
50-
#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED <= 260000
51-
52-
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np
53-
54-
#elif defined(__APPLE__) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 26000
55-
51+
#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 260000
5652
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir
57-
58-
#elif defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
59-
53+
#elif defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < 260000
54+
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np
55+
#elif HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR
6056
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir
61-
6257
#else
63-
6458
#define POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR posix_spawn_file_actions_addchdir_np
65-
6659
#endif
6760
#endif
6861

69-
7062
/* This symbol is defined in ext/standard/config.m4.
7163
* Essentially, it is set if you HAVE_FORK || PHP_WIN32
7264
* Other platforms may modify that configure check and add suitable #ifdefs
@@ -1586,4 +1578,4 @@ PHP_FUNCTION(proc_open)
15861578
}
15871579
/* }}} */
15881580

1589-
#endif /* PHP_CAN_SUPPORT_PROC_OPEN */
1581+
#endif /* PHP_CAN_SUPPORT_PROC_OPEN */

0 commit comments

Comments
 (0)