diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2007-04-30 16:56:18 +0000 | 
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2007-04-30 16:56:18 +0000 | 
| commit | 15fdb055e5a9a944685cf8bcf94e5858589a6740 (patch) | |
| tree | 0f48274fab3bf61e5379abd241da2f704d7da652 /lib/libc/stdlib/getenv.c | |
| parent | 0f23397d3f48d318ba3ad10e8d9e2cdb55657c7e (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdlib/getenv.c')
| -rw-r--r-- | lib/libc/stdlib/getenv.c | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 73ac407b4314..9ff18d8b7784 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -43,7 +43,8 @@ inline char *__findenv(const char *, int *);   * __findenv --   *	Returns pointer to value associated with name, if any, else NULL.   *	Sets offset to be the offset of the name/value combination in the - *	environmental array, for use by setenv(3) and unsetenv(3). + *      environmental array, for use by putenv(3), setenv(3) and unsetenv(3). + *	Explicitly removes '=' in argument name.   *   *	This routine *should* be a static; don't use it.   */ @@ -59,7 +60,9 @@ __findenv(name, offset)  	if (environ == NULL)  		return (NULL); -	len = strlen(name); +	for (np = name; *np && *np != '='; ++np) +		continue; +	len = np - name;  	for (p = environ; (cp = *p) != NULL; ++p) {  		for (np = name, i = len; i && *cp; i--)  			if (*cp++ != *np++) | 
