diff options
| author | naddy <> | 2010-06-29 04:09:34 +0000 |
|---|---|---|
| committer | naddy <> | 2010-06-29 04:09:34 +0000 |
| commit | bc843bdaea2c5cdfa13abd41ea3ea01f533ee149 (patch) | |
| tree | 2d1307205a3213c83bb802e0b4b9bf2864c12620 /src/lib/libc/stdlib | |
| parent | f0f1f4907585831d014bb48ae84cc8655a3570f8 (diff) | |
| download | openbsd-bc843bdaea2c5cdfa13abd41ea3ea01f533ee149.tar.gz openbsd-bc843bdaea2c5cdfa13abd41ea3ea01f533ee149.tar.bz2 openbsd-bc843bdaea2c5cdfa13abd41ea3ea01f533ee149.zip | |
Make unsetenv(NULL) and unsetenv("") give EINVAL, per POSIX. ok deraadt@
Diffstat (limited to 'src/lib/libc/stdlib')
| -rw-r--r-- | src/lib/libc/stdlib/setenv.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c index 2e882cdbe6..89d1e88911 100644 --- a/src/lib/libc/stdlib/setenv.c +++ b/src/lib/libc/stdlib/setenv.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: setenv.c,v 1.11 2009/06/04 20:39:13 millert Exp $ */ | 1 | /* $OpenBSD: setenv.c,v 1.12 2010/06/29 04:09:34 naddy Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 1987 Regents of the University of California. | 3 | * Copyright (c) 1987 Regents of the University of California. |
| 4 | * All rights reserved. | 4 | * All rights reserved. |
| @@ -145,6 +145,10 @@ unsetenv(const char *name) | |||
| 145 | const char *np; | 145 | const char *np; |
| 146 | int offset; | 146 | int offset; |
| 147 | 147 | ||
| 148 | if (!name || !*name) { | ||
| 149 | errno = EINVAL; | ||
| 150 | return (-1); | ||
| 151 | } | ||
| 148 | for (np = name; *np && *np != '='; ++np) | 152 | for (np = name; *np && *np != '='; ++np) |
| 149 | ; | 153 | ; |
| 150 | if (*np) { | 154 | if (*np) { |
