svn commit: trunk/busybox: archival console-tools coreutils e2fspro etc...

vda at busybox.net vda at busybox.net
Tue Feb 6 01:20:13 UTC 2007


Author: vda
Date: 2007-02-05 17:20:12 -0800 (Mon, 05 Feb 2007)
New Revision: 17785

Log:
EXEC_PREFER_APPLETS support by Gabriel L. Somlo <somlo at cmu.edu>


Modified:
   trunk/busybox/archival/tar.c
   trunk/busybox/console-tools/openvt.c
   trunk/busybox/coreutils/chroot.c
   trunk/busybox/coreutils/env.c
   trunk/busybox/coreutils/install.c
   trunk/busybox/coreutils/nice.c
   trunk/busybox/coreutils/nohup.c
   trunk/busybox/e2fsprogs/fsck.c
   trunk/busybox/findutils/xargs.c
   trunk/busybox/include/libbb.h
   trunk/busybox/libbb/execable.c
   trunk/busybox/loginutils/adduser.c
   trunk/busybox/loginutils/login.c
   trunk/busybox/miscutils/devfsd.c
   trunk/busybox/miscutils/setsid.c
   trunk/busybox/miscutils/taskset.c
   trunk/busybox/miscutils/time.c
   trunk/busybox/networking/ifupdown.c
   trunk/busybox/networking/nc.c
   trunk/busybox/runit/chpst.c
   trunk/busybox/runit/runsvdir.c
   trunk/busybox/util-linux/setarch.c


Changeset:
Modified: trunk/busybox/archival/tar.c
===================================================================
--- trunk/busybox/archival/tar.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/archival/tar.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -529,7 +529,7 @@
 			close(gzipStatusPipe[0]);
 			fcntl(gzipStatusPipe[1], F_SETFD, FD_CLOEXEC);	/* close on exec shows success */
 
-			execlp(zip_exec, zip_exec, "-f", NULL);
+			BB_EXECLP(zip_exec, zip_exec, "-f", NULL);
 			vfork_exec_errno = errno;
 
 			close(gzipStatusPipe[1]);

Modified: trunk/busybox/console-tools/openvt.c
===================================================================
--- trunk/busybox/console-tools/openvt.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/console-tools/openvt.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -36,7 +36,7 @@
 		dup2(fd, STDERR_FILENO);
 		while (fd > 2) close(fd--);
 
-		execvp(argv[2], &argv[2]);
+		BB_EXECVP(argv[2], &argv[2]);
 		_exit(1);
 	}
 	return EXIT_SUCCESS;

Modified: trunk/busybox/coreutils/chroot.c
===================================================================
--- trunk/busybox/coreutils/chroot.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/coreutils/chroot.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -33,6 +33,6 @@
 		argv[1] = (char *) "-i";
 	}
 
-	execvp(*argv, argv);
+	BB_EXECVP(*argv, argv);
 	bb_perror_msg_and_die("cannot execute %s", *argv);
 }

Modified: trunk/busybox/coreutils/env.c
===================================================================
--- trunk/busybox/coreutils/env.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/coreutils/env.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -81,7 +81,7 @@
 	}
 
 	if (*argv) {
-		execvp(*argv, argv);
+		BB_EXECVP(*argv, argv);
 		/* SUSv3-mandated exit codes. */
 		xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
 		bb_perror_msg_and_die("%s", *argv);

Modified: trunk/busybox/coreutils/install.c
===================================================================
--- trunk/busybox/coreutils/install.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/coreutils/install.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -126,7 +126,7 @@
 			ret = EXIT_FAILURE;
 		}
 		if (flags & OPT_STRIP) {
-			if (execlp("strip", "strip", dest, NULL) == -1) {
+			if (BB_EXECLP("strip", "strip", dest, NULL) == -1) {
 				bb_perror_msg("strip");
 				ret = EXIT_FAILURE;
 			}

Modified: trunk/busybox/coreutils/nice.c
===================================================================
--- trunk/busybox/coreutils/nice.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/coreutils/nice.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -47,7 +47,7 @@
 		}
 	}
 
-	execvp(*argv, argv);		/* Now exec the desired program. */
+	BB_EXECVP(*argv, argv);		/* Now exec the desired program. */
 
 	/* The exec failed... */
 	xfunc_error_retval = (errno == ENOENT) ? 127 : 126; /* SUSv3 */

Modified: trunk/busybox/coreutils/nohup.c
===================================================================
--- trunk/busybox/coreutils/nohup.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/coreutils/nohup.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -53,7 +53,7 @@
 		close(nullfd);
 	signal(SIGHUP, SIG_IGN);
 
-	execvp(argv[1], argv+1);
+	BB_EXECVP(argv[1], argv+1);
 	if (ENABLE_FEATURE_CLEAN_UP && home)
 		free((char*)nohupout);
 	bb_perror_msg_and_die("%s", argv[1]);

Modified: trunk/busybox/e2fsprogs/fsck.c
===================================================================
--- trunk/busybox/e2fsprogs/fsck.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/e2fsprogs/fsck.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -677,7 +677,7 @@
 				 * Use "fsck -s" to avoid... */
 				close(0);
 			}
-			execvp(argv[0], argv);
+			BB_EXECVP(argv[0], argv);
 			bb_perror_msg_and_die("%s", argv[0]);
 		}
 	}

Modified: trunk/busybox/findutils/xargs.c
===================================================================
--- trunk/busybox/findutils/xargs.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/findutils/xargs.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -60,7 +60,7 @@
 
 	if (p == 0) {
 		/* vfork -- child */
-		execvp(args[0], args);
+		BB_EXECVP(args[0], args);
 		exec_errno = errno;     /* set error to shared stack */
 		_exit(1);
 	}

Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/include/libbb.h	2007-02-06 01:20:12 UTC (rev 17785)
@@ -562,12 +562,13 @@
 int exists_execable(const char *filename);
 
 #ifdef ENABLE_FEATURE_EXEC_PREFER_APPLETS
-#define BB_EXECVP(prog,cmd) \
-	execvp((find_applet_by_name(prog)) ? CONFIG_BUSYBOX_EXEC_PATH : prog, cmd)
+int bb_execvp(const char *file, char *const argv[]);
+#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd)
 #define BB_EXECLP(prog,cmd,...) \
-	execlp((find_applet_by_name(prog)) ? CONFIG_BUSYBOX_EXEC_PATH : prog, cmd, __VA_ARGS__)
+	execlp((find_applet_by_name(prog)) ? CONFIG_BUSYBOX_EXEC_PATH : prog, \
+		cmd, __VA_ARGS__)
 #else
-#define BB_EXECVP(prog,cmd) execvp(prog,cmd)
+#define BB_EXECVP(prog,cmd)     execvp(prog,cmd)
 #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) 
 #endif
 

Modified: trunk/busybox/libbb/execable.c
===================================================================
--- trunk/busybox/libbb/execable.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/libbb/execable.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -59,3 +59,13 @@
 	}
 	return 0;
 }
+
+#ifdef ENABLE_FEATURE_EXEC_PREFER_APPLETS
+/* just like the real execvp, but try to launch an applet named 'file' first
+ */
+int bb_execvp(const char *file, char *const argv[])
+{
+	return execvp(find_applet_by_name(file) ? CONFIG_BUSYBOX_EXEC_PATH : file,
+					argv);
+}
+#endif

Modified: trunk/busybox/loginutils/adduser.c
===================================================================
--- trunk/busybox/loginutils/adduser.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/loginutils/adduser.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -80,7 +80,7 @@
 static void passwd_wrapper(const char *login)
 {
 	static const char prog[] = "passwd";
-	execlp(prog, prog, login, NULL);
+	BB_EXECLP(prog, prog, login, NULL);
 	bb_error_msg_and_die("failed to execute '%s', you must set the password for '%s' manually", prog, login);
 }
 

Modified: trunk/busybox/loginutils/login.c
===================================================================
--- trunk/busybox/loginutils/login.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/loginutils/login.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -357,7 +357,7 @@
 				setenv("LOGIN_UID", utoa(pw->pw_uid), 1);
 				setenv("LOGIN_GID", utoa(pw->pw_gid), 1);
 				setenv("LOGIN_SHELL", pw->pw_shell, 1);
-				execvp(script, t_argv);
+				BB_EXECVP(script, t_argv);
 				exit(1);
 			default: /* parent */
 				wait(NULL);

Modified: trunk/busybox/miscutils/devfsd.c
===================================================================
--- trunk/busybox/miscutils/devfsd.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/miscutils/devfsd.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -378,7 +378,7 @@
 	 /* Child : if arg0 != NULL do execvp */
 	if(arg0 != NULL )
 	{
-		execvp (arg0, arg);
+		BB_EXECVP(arg0, arg);
 		msg_logger_and_die(LOG_ERR, "execvp");
 	}
 }

Modified: trunk/busybox/miscutils/setsid.c
===================================================================
--- trunk/busybox/miscutils/setsid.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/miscutils/setsid.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -36,7 +36,7 @@
 
 	setsid();  /* no error possible */
 
-	execvp(argv[1], argv + 1);
+	BB_EXECVP(argv[1], argv + 1);
 
 	bb_perror_msg_and_die("%s", argv[1]);
 }

Modified: trunk/busybox/miscutils/taskset.c
===================================================================
--- trunk/busybox/miscutils/taskset.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/miscutils/taskset.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -91,7 +91,7 @@
 		goto print_aff;
 	}
 	++argv;
-	execvp(*argv, argv);
+	BB_EXECVP(*argv, argv);
 	bb_perror_msg_and_die("%s", *argv);
 }
 #undef OPT_p

Modified: trunk/busybox/miscutils/time.c
===================================================================
--- trunk/busybox/miscutils/time.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/miscutils/time.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -410,7 +410,7 @@
 	else 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.  */
-		execvp(cmd[0], cmd);
+		BB_EXECVP(cmd[0], cmd);
 		bb_error_msg("cannot run %s", cmd[0]);
 		_exit(errno == ENOENT ? 127 : 126);
 	}

Modified: trunk/busybox/networking/ifupdown.c
===================================================================
--- trunk/busybox/networking/ifupdown.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/networking/ifupdown.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -1004,7 +1004,7 @@
 		close(infd[1]);
 		close(outfd[0]);
 		close(outfd[1]);
-		execvp(command, argv);
+		BB_EXECVP(command, argv);
 		exit(127);
 	default:			/* parent */
 		*in = fdopen(infd[1], "w");

Modified: trunk/busybox/networking/nc.c
===================================================================
--- trunk/busybox/networking/nc.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/networking/nc.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -149,7 +149,7 @@
 		}
 		dup2(0, 1);
 		dup2(0, 2);
-		USE_NC_EXTRA(execvp(execparam[0], execparam);)
+		USE_NC_EXTRA(BB_EXECVP(execparam[0], execparam);)
 		/* Don't print stuff or it will go over the wire.... */
 		_exit(127);
 	}

Modified: trunk/busybox/runit/chpst.c
===================================================================
--- trunk/busybox/runit/chpst.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/runit/chpst.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -310,7 +310,7 @@
 	if (OPT_nostdin) close(0);
 	if (OPT_nostdout) close(1);
 	if (OPT_nostderr) close(2);
-	execvp(argv[0], argv);
+	BB_EXECVP(argv[0], argv);
 	bb_perror_msg_and_die("exec %s", argv[0]);
 }
 
@@ -322,7 +322,7 @@
 	if (!account) bb_show_usage();
 	if (!*++argv) bb_show_usage();
 	suidgid((char*)account);
-	execvp(argv[0], argv);
+	BB_EXECVP(argv[0], argv);
 	bb_perror_msg_and_die("exec %s", argv[0]);
 }
 
@@ -334,7 +334,7 @@
 	if (!account) bb_show_usage();
 	if (!*++argv) bb_show_usage();
 	euidgid((char*)account);
-	execvp(argv[0], argv);
+	BB_EXECVP(argv[0], argv);
 	bb_perror_msg_and_die("exec %s", argv[0]);
 }
 
@@ -346,7 +346,7 @@
 	if (!dir) bb_show_usage();
 	if (!*++argv) bb_show_usage();
 	edir(dir);
-	execvp(argv[0], argv);
+	BB_EXECVP(argv[0], argv);
 	bb_perror_msg_and_die("exec %s", argv[0]);
 }
 
@@ -369,6 +369,6 @@
 	argv += optind;
 	if (!argv[0]) bb_show_usage();
 	slimit();
-	execvp(argv[0], argv);
+	BB_EXECVP(argv[0], argv);
 	bb_perror_msg_and_die("exec %s", argv[0]);
 }

Modified: trunk/busybox/runit/runsvdir.c
===================================================================
--- trunk/busybox/runit/runsvdir.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/runit/runsvdir.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -73,7 +73,7 @@
 		sig_uncatch(SIGHUP);
 		sig_uncatch(SIGTERM);
 		if (pgrp) setsid();
-		execvp(prog[0], prog);
+		BB_EXECVP(prog[0], prog);
 		//pathexec_run(*prog, prog, (char* const*)environ);
 		fatal2_cannot("start runsv ", name);
 	}

Modified: trunk/busybox/util-linux/setarch.c
===================================================================
--- trunk/busybox/util-linux/setarch.c	2007-02-06 00:37:40 UTC (rev 17784)
+++ trunk/busybox/util-linux/setarch.c	2007-02-06 01:20:12 UTC (rev 17785)
@@ -46,7 +46,7 @@
 	if (personality(pers) >= 0) {
 
 		/* Try to execute the program */
-		execvp(argv[0], argv);
+		BB_EXECVP(argv[0], argv);
 	}
 
 	bb_perror_msg_and_die("%s", argv[0]);




More information about the busybox-cvs mailing list