[PATCH] dropbear-051: uClinux vfork

Farrell Aultman fja0568 at gmail.com
Sat Sep 20 06:04:54 WST 2008


Between dropbear-047 and dropbear-051 changes were made that accounted for
the fact that uClinux
needs to use vfork instead of fork.  However, fork was not replaced with
vfork in all places.  I moved the
conditional preproccessor check for uClinux into the includes.h file, so
that fork is always replaced with vfork in
all of the dropbear code when compiling for uClinux.  A side effect is that
the code is cleaner since you just call fork
without wrapping it every time with a conditional preprocessor check.

Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/debian and
../../dropbear-vfork/dropbear-0.51/debian
diff -up ../../dropbear-vanilla/dropbear-0.51/includes.h
../../dropbear-vfork/dropbear-0.51/includes.h
--- ../../dropbear-vanilla/dropbear-0.51/includes.h    2008-03-27
09:17:14.000000000 -0400
+++ ../../dropbear-vfork/dropbear-0.51/includes.h    2008-09-19
10:50:10.000000000 -0400
@@ -120,6 +120,11 @@
 #include <libgen.h>
 #endif

+/* uClinux uses vfork */
+#ifdef __uClinux__
+#define fork vfork
+#endif
+
 #include "libtomcrypt/src/headers/tomcrypt.h"
 #include "libtommath/tommath.h"

Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/libtomcrypt and
../../dropbear-vfork/dropbear-0.51/libtomcrypt
Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/libtommath and
../../dropbear-vfork/dropbear-0.51/libtommath
Common subdirectories: ../../dropbear-vanilla/dropbear-0.51/_MTN and
../../dropbear-vfork/dropbear-0.51/_MTN
Only in ../../dropbear-vfork/dropbear-0.51: patch051.vfork
diff -up ../../dropbear-vanilla/dropbear-0.51/scp.c
../../dropbear-vfork/dropbear-0.51/scp.c
--- ../../dropbear-vanilla/dropbear-0.51/scp.c    2008-03-27
09:17:15.000000000 -0400
+++ ../../dropbear-vfork/dropbear-0.51/scp.c    2008-09-19
10:43:08.000000000 -0400
@@ -200,11 +200,7 @@ do_cmd(char *host, char *remuser, char *
 #endif /* __uClinux__ */

     /* Fork a child to execute the command on the remote host using ssh. */
-#ifdef __uClinux__
-    do_cmd_pid = vfork();
-#else
     do_cmd_pid = fork();
-#endif /* __uClinux__ */

     if (do_cmd_pid == 0) {
         /* Child. */
diff -up ../../dropbear-vanilla/dropbear-0.51/svr-chansession.c
../../dropbear-vfork/dropbear-0.51/svr-chansession.c
--- ../../dropbear-vanilla/dropbear-0.51/svr-chansession.c    2008-03-27
09:17:16.000000000 -0400
+++ ../../dropbear-vfork/dropbear-0.51/svr-chansession.c    2008-09-19
10:41:42.000000000 -0400
@@ -650,11 +650,7 @@ static int noptycommand(struct Channel *
     if (pipe(errfds) != 0)
         return DROPBEAR_FAILURE;

-#ifdef __uClinux__
-    pid = vfork();
-#else
     pid = fork();
-#endif

     if (pid < 0)
         return DROPBEAR_FAILURE;
@@ -754,11 +750,8 @@ static int ptycommand(struct Channel *ch
         return DROPBEAR_FAILURE;
     }

-#ifdef __uClinux__
-    pid = vfork();
-#else
     pid = fork();
-#endif
+
     if (pid < 0)
         return DROPBEAR_FAILURE;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ucc.gu.uwa.edu.au/pipermail/dropbear/attachments/20080919/893b473b/attachment.htm 


More information about the Dropbear mailing list