[PATCH] Correct exit code for demonized processes on no-MMU.

James Coleman james.coleman at ubicom.com
Tue Aug 11 21:09:28 UTC 2009


_exit() takes 1 parameter not 0.  In this case it the first parameter is
now set to 0.  Before this change the exit code was random (depending on
arch).

Signed-off-by: James Coleman <jcoleman at ubicom.com>
---

I had hand merged the no-mmu daemon update change into our port of
0.9.30.1 as it is a great addition.

It works good except it was reported by our QA that the exit codes are
always non-zero even on success. In our case the return value was always
the value of 'ret'.

The patch adds the missing parameter and on ubicom32 does not touch the
stack, I have not tested it on others.

James

 libc/unistd/daemon.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c
index b18d618..f25c48d 100644
--- a/libc/unistd/daemon.c
+++ b/libc/unistd/daemon.c
@@ -67,8 +67,10 @@ static inline pid_t _fork_parent(void)
 {
 	register unsigned long ret = INTERNAL_SYSCALL(clone, wtf, 2, CLONE_VM, 0);
 	if (ret != -1 && ret != 0)
-		/* parent needs to die now w/out touching stack */
-		INTERNAL_SYSCALL(exit, wtf, 0);
+		/* parent needs to die now w/out touching stack and returning
+		 * exit code 0
+		 */
+		INTERNAL_SYSCALL(exit, wtf, 1, 0);
 	return ret;
 }
 static inline pid_t fork_parent(void)
-- 
1.6.1.1



More information about the uClibc mailing list