[PATCH] Fix start-stop-daemon on no-MMU

Alex Landau landau_alex at yahoo.com
Thu Aug 2 06:26:58 UTC 2007


--- Denis Vlasenko <vda.linux at googlemail.com> wrote:

> Applied with some other minor changes added, please check svn
> and yell if you see something bad.
> 
> vda
> 

Yelling! I found several problems, the attached patch fixes them.

1. pid_is_exec(): you changed the return to (~n) from something akin to (!n). This works
fine if n==0, but then n!=0, the returned value is also non-zero, and it breaks the
calling code.
2. When vfork()ing, the parent should exit(0) and not return(0), since the child has run
quite some time and may have changed the return address in stack. So, no returns in the
parent, only function calls. Added a comment about that. Better safe than sorry.
3. After vfork(), the check of (pid==0) to see if I'm the parent is wrong. It should be
(pid!=0).
4. Added a setsid() call just before daemonize_or_rexec.

Alex


      ____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: start-stop-daemon-round2.patch
Type: text/x-patch
Size: 979 bytes
Desc: 660604078-start-stop-daemon-round2.patch
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070801/0c02bdcd/attachment-0002.bin 


More information about the busybox mailing list