summaryrefslogtreecommitdiff
path: root/src/libstddjb/cspawn.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-11 22:57:08 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-11 22:57:08 +0000
commit32544468e5db6a2635b6c0f9e261a288fe7179e9 (patch)
tree9a201bcbd941ab808e0d3d0386aa3b4713f6dac3 /src/libstddjb/cspawn.c
parentbeb9f82f12972b4f4b8830701c4d7ba02ddfbceb (diff)
downloadskalibs-32544468e5db6a2635b6c0f9e261a288fe7179e9.tar.xz
Add POSIX_SPAWN_SETSID_NP support
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/cspawn.c')
-rw-r--r--src/libstddjb/cspawn.c8
1 files changed, 6 insertions, 2 deletions
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)