From 32544468e5db6a2635b6c0f9e261a288fe7179e9 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 11 Sep 2023 22:57:08 +0000 Subject: Add POSIX_SPAWN_SETSID_NP support Signed-off-by: Laurent Bercot --- src/libstddjb/cspawn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/libstddjb') diff --git a/src/libstddjb/cspawn.c b/src/libstddjb/cspawn.c index 8e2298e..cb89481 100644 --- a/src/libstddjb/cspawn.c +++ b/src/libstddjb/cspawn.c @@ -165,6 +165,10 @@ static inline pid_t cspawn_pspawn (char const *prog, char const *const *argv, ch } #ifdef SKALIBS_HASPOSIXSPAWNSETSID if (flags & CSPAWN_FLAGS_SETSID) pfff |= POSIX_SPAWN_SETSID ; +#else +#ifdef SKALIBS_HASPOSIXSPAWNSETSIDNP + if (flags & CSPAWN_FLAGS_SETSID) pfff |= POSIX_SPAWN_SETSID_NP ; +#endif #endif e = posix_spawnattr_setflags(&attr, pfff) ; if (e) goto errattr ; @@ -253,7 +257,7 @@ static inline pid_t cspawn_pspawn (char const *prog, char const *const *argv, ch return 0 ; } -#if defined(SKALIBS_HASPOSIXSPAWNSETSID) && (defined(SKALIBS_HASPOSIXSPAWNCHDIR) || defined(SKALIBS_HASPOSIXSPAWNCHDIRNP)) +#if (defined(SKALIBS_HASPOSIXSPAWNSETSID) || defined(SKALIBS_HASPOSIXSPAWNSETSIDNP)) && (defined(SKALIBS_HASPOSIXSPAWNCHDIR) || defined(SKALIBS_HASPOSIXSPAWNCHDIRNP)) pid_t cspawn (char const *prog, char const *const *argv, char const *const *envp, uint16_t flags, cspawn_fileaction const *fa, size_t n) { @@ -264,7 +268,7 @@ pid_t cspawn (char const *prog, char const *const *argv, char const *const *envp pid_t cspawn (char const *prog, char const *const *argv, char const *const *envp, uint16_t flags, cspawn_fileaction const *fa, size_t n) { -#if !defined(SKALIBS_HASPOSIXSPAWNSETSID) +#if !defined(SKALIBS_HASPOSIXSPAWNSETSID) && !defined(SKALIBS_HASPOSIXSPAWNSETSIDNP) if (flags & CSPAWN_FLAGS_SETSID) goto dofork ; #endif #if !defined(SKALIBS_HASPOSIXSPAWNCHDIR) && !defined(SKALIBS_HASPOSIXSPAWNCHDIRNP) -- cgit v1.2.3