comparison toys/posix/env.c @ 1048:e3ebec880fe6 draft

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.
author Jacek Bukarewicz <j.bukarewicz@samsung.com>
date Thu, 05 Sep 2013 04:58:06 -0500
parents 786841fdb1e0
children 49c851da3658
comparison
equal deleted inserted replaced
1047:d90840f337ea 1048:e3ebec880fe6
43 } 43 }
44 } 44 }
45 45
46 if (!command) { 46 if (!command) {
47 char **ep; 47 char **ep;
48 for (ep = environ; *ep; ep++) xputs(*ep); 48 if (environ) for (ep = environ; *ep; ep++) xputs(*ep);
49 return; 49 } else xexec_optargs(command - toys.optargs);
50 } else xexec(command); 50
51 } 51 }