aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main.c b/main.c
index 7f745490..458d4702 100644
--- a/main.c
+++ b/main.c
@@ -127,6 +127,9 @@ void toy_exec(char *argv[])
{
struct toy_list *which;
+ // don't blank old optargs if our new argc lives in the old optargs.
+ if (argv>=toys.optargs && argv<=toys.optargs+toys.optc) toys.optargs = 0;
+
// Return if we can't find it, or need to re-exec to acquire root,
// or if stack depth is getting silly.
if (!(which = toy_find(argv[0]))) return;