about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2024-08-20 20:08:51 +0000
committerLaurent Bercot <ska@appnovation.com>2024-08-20 20:08:51 +0000
commita7973043c92dc0f9d083e600142a47ce6dd1c9f6 (patch)
treeced0cc476bda507cb0c220785fc8a7359b5a54aa
parent7261b62c6d6a1161c56824631b6a43b166cc7aaf (diff)
downloadskalibs-a7973043c92dc0f9d083e600142a47ce6dd1c9f6.tar.gz
skalibs-a7973043c92dc0f9d083e600142a47ce6dd1c9f6.tar.xz
skalibs-a7973043c92dc0f9d083e600142a47ce6dd1c9f6.zip
bugfix: cspawn (fork): attributes must be handled before file actions!
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--src/libenvexec/cspawn.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libenvexec/cspawn.c b/src/libenvexec/cspawn.c
index 683a0a3..e5e0c4f 100644
--- a/src/libenvexec/cspawn.c
+++ b/src/libenvexec/cspawn.c
@@ -18,6 +18,10 @@
 
 static inline void cspawn_child_exec (char const *prog, char const *const *argv, char const *const *envp, uint16_t flags, cspawn_fileaction const *fa, size_t n)
 {
+  if (flags & CSPAWN_FLAGS_SELFPIPE_FINISH) selfpipe_finish() ;
+  if (flags & CSPAWN_FLAGS_SIGBLOCKNONE) sig_blocknone() ;
+  if (flags & CSPAWN_FLAGS_SETSID) setsid() ;
+
   for (size_t i = 0 ; i < n ; i++)
   {
     switch (fa[i].type)
@@ -48,10 +52,6 @@ static inline void cspawn_child_exec (char const *prog, char const *const *argv,
     }
   }
 
-  if (flags & CSPAWN_FLAGS_SELFPIPE_FINISH) selfpipe_finish() ;
-  if (flags & CSPAWN_FLAGS_SIGBLOCKNONE) sig_blocknone() ;
-  if (flags & CSPAWN_FLAGS_SETSID) setsid() ;
-
   exec_ae(prog, argv, envp) ;
 }