summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2007-05-01 16:02:44 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2007-05-01 16:02:44 +0000
commitba174a5e38b1ab764c4a36ef4dd83e80c4add148 (patch)
treee3e0b3658b8df3a905b3117d8535bb15f42c9e80 /usr.bin
parent8d497697b2ae8684e3ac94eff8bb9ce60dc14a3e (diff)
downloadsrc-test2-ba174a5e38b1ab764c4a36ef4dd83e80c4add148.tar.gz
src-test2-ba174a5e38b1ab764c4a36ef4dd83e80c4add148.zip
Back out all POSIXified *env() changes.
Not because I admit they are technically wrong and not because of bug reports (I receive nothing). But because I surprisingly meets so strong opposition and resistance so lost any desire to continue that. Anyone who interested in POSIX can dig out what changes and how through cvs diffs.
Notes
Notes: svn path=/head/; revision=169177
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/du/du.c6
-rw-r--r--usr.bin/env/env.c6
-rw-r--r--usr.bin/limits/limits.c4
-rw-r--r--usr.bin/login/login.c4
-rw-r--r--usr.bin/su/su.c5
5 files changed, 12 insertions, 13 deletions
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 459a4518738a..00c1f5e728d0 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -140,16 +140,16 @@ main(int argc, char *argv[])
cflag = 1;
break;
case 'h':
- putenv(strdup("BLOCKSIZE=512"));
+ putenv("BLOCKSIZE=512");
hflag = 1;
break;
case 'k':
hflag = 0;
- putenv(strdup("BLOCKSIZE=1024"));
+ putenv("BLOCKSIZE=1024");
break;
case 'm':
hflag = 0;
- putenv(strdup("BLOCKSIZE=1048576"));
+ putenv("BLOCKSIZE=1048576");
break;
case 'n':
nodumpflag = 1;
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c
index b5866efff530..815976fe5f7a 100644
--- a/usr.bin/env/env.c
+++ b/usr.bin/env/env.c
@@ -64,7 +64,7 @@ static void usage(void);
int
main(int argc, char **argv)
{
- char *altpath, **ep, **parg;
+ char *altpath, **ep, *p, **parg;
char *cleanenv[1];
int ch, want_clear;
@@ -102,10 +102,10 @@ main(int argc, char **argv)
if (env_verbosity)
fprintf(stderr, "#env clearing environ\n");
}
- for (argv += optind; *argv && strchr(*argv, '=') != NULL; ++argv) {
+ for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv) {
if (env_verbosity)
fprintf(stderr, "#env setenv:\t%s\n", *argv);
- (void)putenv(strdup(*argv));
+ (void)setenv(*argv, ++p, 1);
}
if (*argv) {
if (altpath)
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index 854803bb1517..e976f369e2ca 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -399,8 +399,8 @@ main(int argc, char *argv[])
login_close(lc);
/* set leading environment variables, like eval(1) */
- while (*argv && strchr(*argv, '=') != NULL)
- (void)putenv(strdup(*argv++));
+ while (*argv && (p = strchr(*argv, '=')))
+ (void)setenv(*argv++, ++p, 1);
/* Set limits */
for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 4a2abb49339d..7827ea1da7d2 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -745,8 +745,8 @@ export_pam_environment()
pam_env = pam_getenvlist(pamh);
if (pam_env != NULL) {
for (pp = pam_env; *pp != NULL; pp++) {
- if (!export(*pp))
- free(*pp);
+ (void)export(*pp);
+ free(*pp);
}
}
}
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index 26f4a3ef9209..76f76b61e64d 100644
--- a/usr.bin/su/su.c
+++ b/usr.bin/su/su.c
@@ -567,9 +567,8 @@ export_pam_environment(void)
for (pp = environ_pam; *pp != NULL; pp++) {
if (ok_to_export(*pp))
- (void)putenv(*pp);
- else
- free(*pp);
+ putenv(*pp);
+ free(*pp);
}
}