summaryrefslogtreecommitdiff
path: root/libc/unistd
diff options
context:
space:
mode:
Diffstat (limited to 'libc/unistd')
-rw-r--r--libc/unistd/daemon.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c
index 3dcd995d2..741672ec0 100644
--- a/libc/unistd/daemon.c
+++ b/libc/unistd/daemon.c
@@ -55,12 +55,14 @@
/* use clone() to get fork() like behavior here -- we just want to disassociate
* from the controlling terminal
*/
-static inline pid_t _fork_parent(void)
+static inline attribute_optimize("O3")
+pid_t _fork_parent(void)
{
- register unsigned long ret = INTERNAL_SYSCALL(clone, wtf, 2, CLONE_VM, 0);
- if (ret != -1 && ret != 0)
+ INTERNAL_SYSCALL_DECL(err);
+ register long ret = INTERNAL_SYSCALL(clone, err, 2, CLONE_VM, 0);
+ if (ret > 0)
/* parent needs to die now w/out touching stack */
- INTERNAL_SYSCALL(exit, wtf, 0);
+ INTERNAL_SYSCALL(exit, err, 1, 0);
return ret;
}
static inline pid_t fork_parent(void)