Again, it would be better to do something like the following in includes.h:<br>+#ifdef __uClinux__<br>+#define exit(x) _exit(x)<br>+#endif<br><br><div class="gmail_quote">On Tue, Oct 21, 2008 at 1:01 AM, Mike Frysinger <span dir="ltr"><<a href="mailto:vapier@gentoo.org">vapier@gentoo.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">On Saturday 20 September 2008, Jamie Lokier wrote:<br>
> Farrell Aultman wrote:<br>
> > Between dropbear-047 and dropbear-051 changes were made that<br>
> > accounted for the fact that uClinux needs to use vfork instead of<br>
> > fork. However, fork was not replaced with vfork in all places. I<br>
> > moved the conditional preproccessor check for uClinux into the<br>
> > includes.h file, so that fork is always replaced with vfork in all<br>
> > of the dropbear code when compiling for uClinux. A side effect is<br>
> > that the code is cleaner since you just call fork without wrapping<br>
> > it every time with a conditional preprocessor check.<br>
><br>
> Have you checked that it's safe to call vfork in all those places?<br>
><br>
> vfork is not always a safe replacement for fork, even on uClinux where<br>
> fork doesn't work.<br>
<br>
</div></div>it istn safe. the exit() calls need to be updated too. the patch i wrote is<br>
here (i could have sworn i posted it already):<br>
--- dropbear-0.51/scp.c<br>
+++ dropbear-0.51/scp.c<br>
@@ -130,13 +130,22 @@<br>
fprintf(stderr, " %s", a->list[i]);<br>
fprintf(stderr, "\n");<br>
}<br>
- if ((pid = fork()) == -1)<br>
<div class="Ih2E3d">+#ifdef __uClinux__<br>
+ pid = vfork();<br>
+#else<br>
+ pid = fork();<br>
</div>+#endif /* __uClinux__ */<br>
+ if (pid == -1)<br>
fatal("do_local_cmd: fork: %s", strerror(errno));<br>
<br>
if (pid == 0) {<br>
execvp(a->list[0], a->list);<br>
perror(a->list[0]);<br>
+#ifdef __uClinux__<br>
+ _exit(1);<br>
+#else<br>
exit(1);<br>
+#endif /* __uClinux__ */<br>
}<br>
<br>
do_cmd_pid = pid;<br>
@@ -225,7 +234,11 @@<br>
<br>
execvp(ssh_program, args.list);<br>
perror(ssh_program);<br>
+#ifndef __uClinux__<br>
exit(1);<br>
+#else<br>
+ _exit(1);<br>
+#endif /* __uClinux__ */<br>
} else if (do_cmd_pid == -1) {<br>
fatal("fork: %s", strerror(errno));<br>
}<br>
<font color="#888888">-mike<br>
</font></blockquote></div><br>