gspawn: safe_closefrom for Solaris 11.3/11.4

When F_CLOSEFROM is defined, we know that closefrom() is signal safe.
This commit is contained in:
Casper Dik 2021-08-01 12:43:19 -07:00 committed by Alan Coopersmith
parent 6549a36535
commit 790571a2cd

View File

@ -1487,7 +1487,8 @@ safe_fdwalk (int (*cb)(void *data, int fd), void *data)
static void
safe_closefrom (int lowfd)
{
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#if defined(__FreeBSD__) || defined(__OpenBSD__) || \
(defined(__sun__) && defined(F_CLOSEFROM))
/* Use closefrom function provided by the system if it is known to be
* async-signal safe.
*
@ -1496,6 +1497,9 @@ safe_closefrom (int lowfd)
*
* OpenBSD: closefrom is not included in the list, but a direct system call
* should be safe to use.
*
* In Solaris as of 11.3 SRU 31, closefrom() is also a direct system call.
* On such systems, F_CLOSEFROM is defined.
*/
(void) closefrom (lowfd);
#elif defined(__DragonFly__)