aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix/spawni.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/spawni.c')
-rw-r--r--sysdeps/posix/spawni.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index 5cc2ad1363..9cad25ca4e 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -101,7 +101,8 @@ __spawni (pid_t *pid, const char *file,
to POSIX. */
|| ((flags & (POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF
| POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER
- | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_RESETIDS)) == 0
+ | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_RESETIDS
+ | POSIX_SPAWN_SETSID)) == 0
&& file_actions == NULL))
new_pid = __vfork ();
else
@@ -159,6 +160,10 @@ __spawni (pid_t *pid, const char *file,
}
#endif
+ if ((flags & POSIX_SPAWN_SETSID) != 0
+ && __setsid () < 0)
+ _exit (SPAWN_ERROR);
+
/* Set the process group ID. */
if ((flags & POSIX_SPAWN_SETPGROUP) != 0
&& __setpgid (0, attrp->__pgrp) != 0)