diff options
Diffstat (limited to 'src/lib/libc/stdlib')
| -rw-r--r-- | src/lib/libc/stdlib/getenv.3 | 22 | ||||
| -rw-r--r-- | src/lib/libc/stdlib/setenv.c | 8 |
2 files changed, 10 insertions, 20 deletions
diff --git a/src/lib/libc/stdlib/getenv.3 b/src/lib/libc/stdlib/getenv.3 index 8c2b633f25..f987eb13a1 100644 --- a/src/lib/libc/stdlib/getenv.3 +++ b/src/lib/libc/stdlib/getenv.3 | |||
| @@ -29,9 +29,9 @@ | |||
| 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. |
| 31 | .\" | 31 | .\" |
| 32 | .\" $OpenBSD: getenv.3,v 1.17 2012/06/02 00:14:16 guenther Exp $ | 32 | .\" $OpenBSD: getenv.3,v 1.18 2012/09/23 16:08:04 jeremy Exp $ |
| 33 | .\" | 33 | .\" |
| 34 | .Dd $Mdocdate: June 2 2012 $ | 34 | .Dd $Mdocdate: September 23 2012 $ |
| 35 | .Dt GETENV 3 | 35 | .Dt GETENV 3 |
| 36 | .Os | 36 | .Os |
| 37 | .Sh NAME | 37 | .Sh NAME |
| @@ -53,14 +53,6 @@ | |||
| 53 | .Sh DESCRIPTION | 53 | .Sh DESCRIPTION |
| 54 | These functions set, unset, and fetch environment variables from the host | 54 | These functions set, unset, and fetch environment variables from the host |
| 55 | .Em environment list . | 55 | .Em environment list . |
| 56 | For compatibility with differing environment conventions, the given argument | ||
| 57 | .Fa name | ||
| 58 | may be appended with an equal sign | ||
| 59 | .Dq Li \&= | ||
| 60 | followed by zero or more characters, | ||
| 61 | and | ||
| 62 | .Fa value | ||
| 63 | may be prepended with an equal sign. | ||
| 64 | .Pp | 56 | .Pp |
| 65 | The | 57 | The |
| 66 | .Fn getenv | 58 | .Fn getenv |
| @@ -125,19 +117,15 @@ The | |||
| 125 | .Fn setenv | 117 | .Fn setenv |
| 126 | or | 118 | or |
| 127 | .Fn unsetenv | 119 | .Fn unsetenv |
| 128 | function was passed a | 120 | function was passed an empty |
| 121 | .Ar name | ||
| 122 | or a NULL pointer, or was passed a | ||
| 129 | .Ar name | 123 | .Ar name |
| 130 | containing an | 124 | containing an |
| 131 | .Sq = | 125 | .Sq = |
| 132 | character. | 126 | character. |
| 133 | .Pp | 127 | .Pp |
| 134 | The | 128 | The |
| 135 | .Fn unsetenv | ||
| 136 | function was passed an empty | ||
| 137 | .Ar name | ||
| 138 | or a NULL pointer. | ||
| 139 | .Pp | ||
| 140 | The | ||
| 141 | .Fn putenv | 129 | .Fn putenv |
| 142 | function was passed a | 130 | function was passed a |
| 143 | .Ar string | 131 | .Ar string |
diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c index 089ab92d38..9060fdba88 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.13 2010/08/23 22:31:50 millert Exp $ */ | 1 | /* $OpenBSD: setenv.c,v 1.14 2012/09/23 16:08:04 jeremy 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. |
| @@ -94,14 +94,16 @@ setenv(const char *name, const char *value, int rewrite) | |||
| 94 | const char *np; | 94 | const char *np; |
| 95 | int l_value, offset = 0; | 95 | int l_value, offset = 0; |
| 96 | 96 | ||
| 97 | if (!name || !*name) { | ||
| 98 | errno = EINVAL; | ||
| 99 | return (-1); | ||
| 100 | } | ||
| 97 | for (np = name; *np && *np != '='; ++np) | 101 | for (np = name; *np && *np != '='; ++np) |
| 98 | ; | 102 | ; |
| 99 | #ifdef notyet | ||
| 100 | if (*np) { | 103 | if (*np) { |
| 101 | errno = EINVAL; | 104 | errno = EINVAL; |
| 102 | return (-1); /* has `=' in name */ | 105 | return (-1); /* has `=' in name */ |
| 103 | } | 106 | } |
| 104 | #endif | ||
| 105 | 107 | ||
| 106 | l_value = strlen(value); | 108 | l_value = strlen(value); |
| 107 | if ((C = __findenv(name, (int)(np - name), &offset)) != NULL) { | 109 | if ((C = __findenv(name, (int)(np - name), &offset)) != NULL) { |
