# HG changeset patch # User Jacek Bukarewicz # Date 1378375086 18000 # Node ID e3ebec880fe675081fc1c41cb7d8821a506ea905 # Parent d90840f337ead41a139f709cc06c0c1aeb00fe2e env - there were 2 segfaults when run on my Ubuntu 12.04 machine: - one is because eglibc sets environ to NULL on clearenv(). I added check for environ being not NULL when iterating over environment variables - switched xexec to xexec_optargs because command argument is a pointer to optarg which is freed by xexec. diff -r d90840f337ea -r e3ebec880fe6 toys/posix/env.c --- a/toys/posix/env.c Thu Sep 05 04:28:40 2013 -0500 +++ b/toys/posix/env.c Thu Sep 05 04:58:06 2013 -0500 @@ -45,7 +45,7 @@ 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); + }