svn commit: trunk/busybox: miscutils networking runit util-linux

vda at busybox.net vda at busybox.net
Thu Feb 26 12:30:00 UTC 2009


Author: vda
Date: 2009-02-26 12:29:59 +0000 (Thu, 26 Feb 2009)
New Revision: 25463

Log:
runsv: small optimization
*: more paranoia around passing NULL to execl[e]

function                                             old     new   delta
custom                                               240     221     -19



Modified:
   trunk/busybox/miscutils/crond.c
   trunk/busybox/networking/ifupdown.c
   trunk/busybox/runit/runsv.c
   trunk/busybox/runit/runsvdir.c
   trunk/busybox/util-linux/script.c


Changeset:
Modified: trunk/busybox/miscutils/crond.c
===================================================================
--- trunk/busybox/miscutils/crond.c	2009-02-26 12:00:52 UTC (rev 25462)
+++ trunk/busybox/miscutils/crond.c	2009-02-26 12:29:59 UTC (rev 25463)
@@ -775,7 +775,7 @@
 		}
 		/* crond 3.0pl1-100 puts tasks in separate process groups */
 		bb_setpgrp();
-		execlp(prog, prog, cmd, arg, NULL);
+		execlp(prog, prog, cmd, arg, (char *) NULL);
 		crondlog(ERR20 "can't exec, user %s cmd %s %s %s", user, prog, cmd, arg);
 		if (mail_filename) {
 			fdprintf(1, "Exec failed: %s -c %s\n", prog, arg);
@@ -912,7 +912,7 @@
 		}
 		/* crond 3.0pl1-100 puts tasks in separate process groups */
 		bb_setpgrp();
-		execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", line->cl_Shell, NULL);
+		execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", line->cl_Shell, (char *) NULL);
 		crondlog(ERR20 "can't exec, user %s cmd %s %s %s", user,
 				 DEFAULT_SHELL, "-c", line->cl_Shell);
 		_exit(EXIT_SUCCESS);

Modified: trunk/busybox/networking/ifupdown.c
===================================================================
--- trunk/busybox/networking/ifupdown.c	2009-02-26 12:00:52 UTC (rev 25462)
+++ trunk/busybox/networking/ifupdown.c	2009-02-26 12:29:59 UTC (rev 25463)
@@ -982,7 +982,7 @@
 		case -1: /* failure */
 			return 0;
 		case 0: /* child */
-			execle(DEFAULT_SHELL, DEFAULT_SHELL, "-c", str, NULL, my_environ);
+			execle(DEFAULT_SHELL, DEFAULT_SHELL, "-c", str, (char *) NULL, my_environ);
 			_exit(127);
 		}
 		safe_waitpid(child, &status, 0);

Modified: trunk/busybox/runit/runsv.c
===================================================================
--- trunk/busybox/runit/runsv.c	2009-02-26 12:00:52 UTC (rev 25462)
+++ trunk/busybox/runit/runsv.c	2009-02-26 12:29:59 UTC (rev 25463)
@@ -251,7 +251,6 @@
 	int w;
 	char a[10];
 	struct stat st;
-	char *prog[2];
 
 	if (s->islog) return 0;
 	strcpy(a, "control/?");
@@ -267,13 +266,11 @@
 				/* child */
 				if (haslog && dup2(logpipe.wr, 1) == -1)
 					warn_cannot("setup stdout for control/?");
-				prog[0] = a;
-				prog[1] = NULL;
-				execv(a, prog);
+				execl(a, a, (char *) NULL);
 				fatal_cannot("run control/?");
 			}
 			/* parent */
-			while (safe_waitpid(pid, &w, 0) == -1) {
+			if (safe_waitpid(pid, &w, 0) == -1) {
 				warn_cannot("wait for child control/?");
 				return 0;
 			}

Modified: trunk/busybox/runit/runsvdir.c
===================================================================
--- trunk/busybox/runit/runsvdir.c	2009-02-26 12:00:52 UTC (rev 25462)
+++ trunk/busybox/runit/runsvdir.c	2009-02-26 12:29:59 UTC (rev 25463)
@@ -119,7 +119,7 @@
 			| (1 << SIGTERM)
 			, SIG_DFL);
 #endif
-		execlp("runsv", "runsv", name, NULL);
+		execlp("runsv", "runsv", name, (char *) NULL);
 		fatal2_cannot("start runsv ", name);
 	}
 	return pid;

Modified: trunk/busybox/util-linux/script.c
===================================================================
--- trunk/busybox/util-linux/script.c	2009-02-26 12:00:52 UTC (rev 25462)
+++ trunk/busybox/util-linux/script.c	2009-02-26 12:29:59 UTC (rev 25463)
@@ -181,6 +181,6 @@
 
 	/* Non-ignored signals revert to SIG_DFL on exec anyway */
 	/*signal(SIGCHLD, SIG_DFL);*/
-	execl(shell, shell, shell_opt, shell_arg, NULL);
+	execl(shell, shell, shell_opt, shell_arg, (char *) NULL);
 	bb_simple_perror_msg_and_die(shell);
 }



More information about the busybox-cvs mailing list