aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/env.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/posix/env.c b/toys/posix/env.c
index 8f7ccf1f..4e819f24 100644
--- a/toys/posix/env.c
+++ b/toys/posix/env.c
@@ -45,7 +45,7 @@ void env_main(void)
if (!command) {
char **ep;
- for (ep = environ; *ep; ep++) xputs(*ep);
- return;
- } else xexec(command);
+ if (environ) for (ep = environ; *ep; ep++) xputs(*ep);
+ } else xexec_optargs(command - toys.optargs);
+
}