about summary refs log tree commit diff
path: root/src/process
diff options
context:
space:
mode:
Diffstat (limited to 'src/process')
-rw-r--r--src/process/posix_spawn.c2
-rw-r--r--src/process/system.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
index c3e800b8..5eb516b0 100644
--- a/src/process/posix_spawn.c
+++ b/src/process/posix_spawn.c
@@ -35,9 +35,9 @@ int __posix_spawnx(pid_t *restrict res, const char *restrict path,
 
 	__acquire_ptc();
 	pid = __vfork();
-	__release_ptc();
 
 	if (pid) {
+		__release_ptc();
 		sigprocmask(SIG_SETMASK, &oldmask, 0);
 		if (pid < 0) return -pid;
 		*res = pid;
diff --git a/src/process/system.c b/src/process/system.c
index c8f26008..ebe207f5 100644
--- a/src/process/system.c
+++ b/src/process/system.c
@@ -29,7 +29,8 @@ int system(const char *cmd)
 
 	__acquire_ptc();
 	pid = __vfork();
-	__release_ptc();
+
+	if (pid) __release_ptc();
 
 	if (pid > 0) {
 		sigset_t new = old;