summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-19 20:11:33 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-19 20:11:33 +0000
commit9c4140bada25cc97aaf407e2f43336a512f5139e (patch)
treec4fbb4d7ade066e7c6619799ec829a5f4ae1f784 /sysdeps
parent336c2454d6c4231942b2c04f01467d15b3ad8faa (diff)
(__add_to_environ): Initialize ep after we have the lock.
Avoid warning about uninitialized variable.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/setenv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index fc58e9b346..29fc60c3fb 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -120,17 +120,21 @@ __add_to_environ (name, value, combined, replace)
LOCK;
+ /* We have to get the pointer now that we have the lock and not earlier
+ since another thread might have created a new environment. */
+ ep = __environ;
+
size = 0;
- if (__environ != NULL)
+ if (ep != NULL)
{
- for (ep = __environ; *ep != NULL; ++ep)
+ for (; *ep != NULL; ++ep)
if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
break;
else
++size;
}
- if (__environ == NULL || *ep == NULL)
+ if (ep == NULL || *ep == NULL)
{
char **new_environ;
#ifdef USE_TSEARCH