summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2007-05-01 16:02:44 +0000
committerache <ache@FreeBSD.org>2007-05-01 16:02:44 +0000
commit6ccaf050cc62bc9d81ac3acb71ce640739caa0f7 (patch)
treee3e0b3658b8df3a905b3117d8535bb15f42c9e80 /usr.bin
parent61e9800ad7707590037d6868c703475f36cf7058 (diff)
downloadFreeBSD-src-6ccaf050cc62bc9d81ac3acb71ce640739caa0f7.zip
FreeBSD-src-6ccaf050cc62bc9d81ac3acb71ce640739caa0f7.tar.gz
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.
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 459a451..00c1f5e 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 b5866ef..815976f 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 854803b..e976f36 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 4a2abb4..7827ea1 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 26f4a3e..76f76b6 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);
}
}
OpenPOWER on IntegriCloud