diff options
author | 2009-03-01 17:02:25 +0000 | |
---|---|---|
committer | 2009-03-01 17:02:25 +0000 | |
commit | 568d928b6680dcab25285d41c29cc212992025fe (patch) | |
tree | aa52b7fb0ece0b5676aaed5fb7d92193a95b2bda | |
parent | Update to match mktemp.c changes (diff) | |
download | wireguard-openbsd-568d928b6680dcab25285d41c29cc212992025fe.tar.xz wireguard-openbsd-568d928b6680dcab25285d41c29cc212992025fe.zip |
Don't rely on non-standard setenv() behavior.
-rw-r--r-- | usr.bin/env/env.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c index 8240bf28928..b747629f90d 100644 --- a/usr.bin/env/env.c +++ b/usr.bin/env/env.c @@ -1,4 +1,4 @@ -/* $OpenBSD: env.c,v 1.12 2006/05/28 05:29:54 ray Exp $ */ +/* $OpenBSD: env.c,v 1.13 2009/03/01 17:02:25 millert Exp $ */ /* * Copyright (c) 1988, 1993, 1994 @@ -37,7 +37,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)env.c 8.3 (Berkeley) 4/2/94";*/ -static char rcsid[] = "$OpenBSD: env.c,v 1.12 2006/05/28 05:29:54 ray Exp $"; +static char rcsid[] = "$OpenBSD: env.c,v 1.13 2009/03/01 17:02:25 millert Exp $"; #endif /* not lint */ #include <err.h> @@ -73,11 +73,13 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - for (; *argv && (p = strchr(*argv, '=')); ++argv) - if (setenv(*argv, ++p, 1) == -1) { + for (; *argv && (p = strchr(*argv, '=')); ++argv) { + *p++ = '\0'; + if (setenv(*argv, p, 1) == -1) { /* reuse 126, it matches the problem most */ exit(126); } + } if (*argv) { /* |