diff options
author | gahr <gahr@FreeBSD.org> | 2016-10-26 08:39:33 +0000 |
---|---|---|
committer | gahr <gahr@FreeBSD.org> | 2016-10-26 08:39:33 +0000 |
commit | 2b54e88233a532d32f0a2af466504d3f825594f4 (patch) | |
tree | 47274f89faf93e7f5154b2c2a119cfe052342a34 /usr.bin | |
parent | dbc4c0c7759386f02c8a8ea019e0bc10006fbf51 (diff) | |
download | FreeBSD-src-2b54e88233a532d32f0a2af466504d3f825594f4.zip FreeBSD-src-2b54e88233a532d32f0a2af466504d3f825594f4.tar.gz |
MFC r307638:
Chase a cornercase in printenv and sync its behaviour with builtin's
The cornercase is when printenv is passed a parameter in the form
VAR=val, where VAR=val exists in the environment. In this case, printenv would
print a spurious newline and returns 0.
Approved by: cognet
MFC after: 1 week
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/printenv/printenv.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/printenv/printenv.c b/usr.bin/printenv/printenv.c index 315833e..27882ab 100644 --- a/usr.bin/printenv/printenv.c +++ b/usr.bin/printenv/printenv.c @@ -83,8 +83,8 @@ main(int argc, char *argv[]) for (ep = environ; *ep; ep++) if (!memcmp(*ep, *argv, len)) { cp = *ep + len; - if (!*cp || *cp == '=') { - (void)printf("%s\n", *cp ? cp + 1 : cp); + if (*cp == '=') { + (void)printf("%s\n", cp + 1); exit(0); } } |