mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-28 03:27:46 +08:00
2008-09-26 Craig Howland <howland@LGSInnovations.com>
* libc/stdlib/getenv_r.c (_getenv_r): Modify to not match if name contains an equal sign.
This commit is contained in:
parent
610eefefdd
commit
9e71090b9a
@ -1,3 +1,8 @@
|
|||||||
|
2008-09-26 Craig Howland <howland@LGSInnovations.com>
|
||||||
|
|
||||||
|
* libc/stdlib/getenv_r.c (_getenv_r): Modify to not match if name
|
||||||
|
contains an equal sign.
|
||||||
|
|
||||||
2008-09-25 Raphael Derossa Pereira <raphaelpereira@gmail.com>
|
2008-09-25 Raphael Derossa Pereira <raphaelpereira@gmail.com>
|
||||||
|
|
||||||
* libc/include/pthread.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add
|
* libc/include/pthread.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add
|
||||||
|
@ -29,7 +29,8 @@ A pointer to the (string) value of the environment variable, or
|
|||||||
|
|
||||||
PORTABILITY
|
PORTABILITY
|
||||||
<<_getenv_r>> is not ANSI; the rules for properly forming names of environment
|
<<_getenv_r>> is not ANSI; the rules for properly forming names of environment
|
||||||
variables vary from one system to another.
|
variables vary from one system to another. This implementation does not
|
||||||
|
permit '=' to be in identifiers.
|
||||||
|
|
||||||
<<_getenv_r>> requires a global pointer <<environ>>.
|
<<_getenv_r>> requires a global pointer <<environ>>.
|
||||||
*/
|
*/
|
||||||
@ -98,9 +99,13 @@ _DEFUN (_findenv_r, (reent_ptr, name, offset),
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(name);
|
c = name;
|
||||||
c = name + len;
|
while (*c && *c != '=') c++;
|
||||||
|
|
||||||
|
/* Identifiers may not contain an '=', so cannot match if does */
|
||||||
|
if(*c != '=')
|
||||||
|
{
|
||||||
|
len = c - name;
|
||||||
for (p = *p_environ; *p; ++p)
|
for (p = *p_environ; *p; ++p)
|
||||||
if (!strncmp (*p, name, len))
|
if (!strncmp (*p, name, len))
|
||||||
if (*(c = *p + len) == '=')
|
if (*(c = *p + len) == '=')
|
||||||
@ -109,6 +114,7 @@ _DEFUN (_findenv_r, (reent_ptr, name, offset),
|
|||||||
ENV_UNLOCK;
|
ENV_UNLOCK;
|
||||||
return (char *) (++c);
|
return (char *) (++c);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ENV_UNLOCK;
|
ENV_UNLOCK;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user