diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | sysdeps/generic/setenv.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index caa5a5a47a..69294b6344 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 1999-08-18 Ulrich Drepper <drepper@cygnus.com> + * sysdeps/generic/setenv.c: Avoid warning about uninitialized variable. + * libio/fileops.c (_IO_file_xsgetn): Allocate buffer if none is allocated so far. [PR libc/1261]. diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c index fc58e9b346..387152dcad 100644 --- a/sysdeps/generic/setenv.c +++ b/sysdeps/generic/setenv.c @@ -113,7 +113,7 @@ __add_to_environ (name, value, combined, replace) const char *combined; int replace; { - register char **ep; + register char **ep = __environ; register size_t size; const size_t namelen = strlen (name); const size_t vallen = value != NULL ? strlen (value) + 1 : 0; @@ -121,16 +121,16 @@ __add_to_environ (name, value, combined, replace) LOCK; 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 |