From 977e48e1626b3e3f1f1f9b14f05ffc11e252455f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 20 Oct 2014 19:52:29 -0500 Subject: Add TOYBOX_NORECURSE so xexec() won't make internal function calls. --- Config.in | 14 +++++++++++++- lib/xwrap.c | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Config.in b/Config.in index c546fc43..29cf4e1f 100644 --- a/Config.in +++ b/Config.in @@ -71,6 +71,19 @@ config TOYBOX_FREE without a real OS (ala newlib+libgloss), enable this to make toybox clean up after itself. +config TOYBOX_NORECURSE + bool "Disable recursive execution" + default n + help + When one toybox command calls another, usually it just calls the new + command's main() function rather than searching the $PATH and calling + exec on another file (which is much slower). + + This disables that optimization, so toybox will run external commands + even when it has a built-in version of that command. This requires + toybox symlinks to be installed in the $PATH, or re-invoking the + "toybox" multiplexer command by name. + config TOYBOX_DEBUG bool "Debugging tests" default n @@ -89,5 +102,4 @@ config TOYBOX_UID_USR default 500 help When commands like useradd/groupadd allocate user IDs, start here. - endmenu diff --git a/lib/xwrap.c b/lib/xwrap.c index 341aac35..b7eb2741 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -137,7 +137,7 @@ void xexec_optargs(int skip) // with a path isn't a builtin, so /bin/sh won't match the builtin sh. void xexec(char **argv) { - if (CFG_TOYBOX) toy_exec(argv); + if (CFG_TOYBOX && !CFG_TOYBOX_NORECURSE) toy_exec(argv); execvp(argv[0], argv); perror_exit("exec %s", argv[0]); -- cgit v1.2.3