summaryrefslogtreecommitdiff
path: root/coreutils/env.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-03-14 22:08:04 +0000
committerDenis Vlasenko2007-03-14 22:08:04 +0000
commit16c7fb7fc5ae647bcc273827f507d90866419560 (patch)
tree35766e878699512ceac5c73829308c6caaa9fa1d /coreutils/env.c
parente1e93c1e1cf0ddbb1749176d5f1fc430c869c37a (diff)
downloadbusybox-16c7fb7fc5ae647bcc273827f507d90866419560.zip
busybox-16c7fb7fc5ae647bcc273827f507d90866419560.tar.gz
chown, env: stop using statics
Diffstat (limited to 'coreutils/env.c')
-rw-r--r--coreutils/env.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/coreutils/env.c b/coreutils/env.c
index 7be0c63..f47d450 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -44,8 +44,8 @@ static const struct option env_long_options[] = {
int env_main(int argc, char** argv);
int env_main(int argc, char** argv)
{
- static char *cleanenv[1] = { NULL };
-
+ /* cleanenv was static - why? */
+ char *cleanenv[1];
char **ep;
unsigned opt;
llist_t *unset_env = NULL;
@@ -55,18 +55,16 @@ int env_main(int argc, char** argv)
#if ENABLE_FEATURE_ENV_LONG_OPTIONS
applet_long_options = env_long_options;
#endif
-
opt = getopt32(argc, argv, "+iu:", &unset_env);
-
argv += optind;
if (*argv && LONE_DASH(argv[0])) {
opt |= 1;
++argv;
}
-
- if (opt & 1)
+ if (opt & 1) {
+ cleanenv[0] = NULL;
environ = cleanenv;
- else if (opt & 2) {
+ } else if (opt & 2) {
while (unset_env) {
unsetenv(unset_env->data);
unset_env = unset_env->link;