svn commit: trunk/busybox: archival archival/libunarchive miscutils etc...

vda at busybox.net vda at busybox.net
Tue Jul 1 16:09:07 UTC 2008


Author: vda
Date: 2008-07-01 09:09:07 -0700 (Tue, 01 Jul 2008)
New Revision: 22595

Log:
sendmail: fix wrong vfork usage here too
*: shorten error texts

function                                             old     new   delta
launch_helper                                          -     151    +151
vfork_or_die                                          20       -     -20
sendgetmail_main                                    1946    1848     -98
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 151/-118)           Total: 33 bytes



Modified:
   trunk/busybox/archival/libunarchive/open_transformer.c
   trunk/busybox/archival/tar.c
   trunk/busybox/miscutils/time.c
   trunk/busybox/networking/nc.c
   trunk/busybox/networking/sendmail.c
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/archival/libunarchive/open_transformer.c
===================================================================
--- trunk/busybox/archival/libunarchive/open_transformer.c	2008-07-01 15:59:42 UTC (rev 22594)
+++ trunk/busybox/archival/libunarchive/open_transformer.c	2008-07-01 16:09:07 UTC (rev 22595)
@@ -23,11 +23,11 @@
 #if BB_MMU
 	pid = fork();
 	if (pid == -1)
-		bb_perror_msg_and_die("can't fork");
+		bb_perror_msg_and_die("vfork" + 1);
 #else
 	pid = vfork();
 	if (pid == -1)
-		bb_perror_msg_and_die("can't vfork");
+		bb_perror_msg_and_die("vfork");
 #endif
 
 	if (pid == 0) {

Modified: trunk/busybox/archival/tar.c
===================================================================
--- trunk/busybox/archival/tar.c	2008-07-01 15:59:42 UTC (rev 22594)
+++ trunk/busybox/archival/tar.c	2008-07-01 16:09:07 UTC (rev 22595)
@@ -538,7 +538,7 @@
 
 	gzipPid = vfork();
 	if (gzipPid < 0)
-		bb_perror_msg_and_die("can't vfork");
+		bb_perror_msg_and_die("vfork");
 
 	if (gzipPid == 0) {
 		/* child */

Modified: trunk/busybox/miscutils/time.c
===================================================================
--- trunk/busybox/miscutils/time.c	2008-07-01 15:59:42 UTC (rev 22594)
+++ trunk/busybox/miscutils/time.c	2008-07-01 16:09:07 UTC (rev 22595)
@@ -374,7 +374,7 @@
 	resp->elapsed_ms = monotonic_us() / 1000;
 	pid = vfork();		/* Run CMD as child process.  */
 	if (pid < 0)
-		bb_error_msg_and_die("cannot fork");
+		bb_perror_msg_and_die("fork");
 	if (pid == 0) {	/* If child.  */
 		/* Don't cast execvp arguments; that causes errors on some systems,
 		   versus merely warnings if the cast is left off.  */

Modified: trunk/busybox/networking/nc.c
===================================================================
--- trunk/busybox/networking/nc.c	2008-07-01 15:59:42 UTC (rev 22594)
+++ trunk/busybox/networking/nc.c	2008-07-01 16:09:07 UTC (rev 22595)
@@ -150,12 +150,9 @@
 			goto accept_again;
 		}
 		/* child (or main thread if no multiple -l) */
-		if (cfd) {
-			dup2(cfd, 0);
-			close(cfd);
-		}
-		dup2(0, 1);
-		dup2(0, 2);
+		xmove_fd(cfd, 0);
+		xdup2(0, 1);
+		xdup2(0, 2);
 		USE_NC_EXTRA(BB_EXECVP(execparam[0], execparam);)
 		/* Don't print stuff or it will go over the wire.... */
 		_exit(127);

Modified: trunk/busybox/networking/sendmail.c
===================================================================
--- trunk/busybox/networking/sendmail.c	2008-07-01 15:59:42 UTC (rev 22594)
+++ trunk/busybox/networking/sendmail.c	2008-07-01 16:09:07 UTC (rev 22595)
@@ -120,15 +120,6 @@
 #undef err
 }
 
-/* libbb candidate */
-static pid_t vfork_or_die(void)
-{
-	pid_t pid = vfork();
-	if (pid < 0)
-		bb_perror_msg_and_die("vfork");
-	return pid;
-}
-
 static void launch_helper(const char **argv)
 {
 	// setup vanilla unidirectional pipes interchange
@@ -137,7 +128,9 @@
 
 	xpipe(pipes);
 	xpipe(pipes+2);
-	helper_pid = vfork_or_die();
+	helper_pid = vfork();
+	if (helper_pid < 0)
+		bb_perror_msg_and_die("vfork");
 	idx = (!helper_pid) * 2;
 	xdup2(pipes[idx], STDIN_FILENO);
 	xdup2(pipes[3-idx], STDOUT_FILENO);

Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2008-07-01 15:59:42 UTC (rev 22594)
+++ trunk/busybox/shell/ash.c	2008-07-01 16:09:07 UTC (rev 22595)
@@ -4581,7 +4581,7 @@
 		TRACE(("Fork failed, errno=%d", errno));
 		if (jp)
 			freejob(jp);
-		ash_msg_and_raise_error("cannot fork");
+		ash_msg_and_raise_error("can't fork");
 	}
 	if (pid == 0)
 		forkchild(jp, /*n,*/ mode);




More information about the busybox-cvs mailing list