1999-02-21  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/glob.c (glob): Enlarge buffers for reentrant
	lookup functions if it is too small.
This commit is contained in:
Ulrich Drepper 1999-02-21 09:55:41 +00:00
parent ad9570d733
commit f6b56b5530
2 changed files with 29 additions and 8 deletions

View File

@ -1,3 +1,8 @@
1999-02-21 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/glob.c (glob): Enlarge buffers for reentrant
lookup functions if it is too small.
1999-02-20 Ulrich Drepper <drepper@cygnus.com> 1999-02-20 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-deps.c (_dl_map_object_deps): Don't add dummy objects created * elf/dl-deps.c (_dl_map_object_deps): Don't add dummy objects created

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc. /* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
@ -649,8 +649,18 @@ glob (pattern, flags, errfunc, pglob)
pwbuflen = 1024; pwbuflen = 1024;
pwtmpbuf = (char *) __alloca (pwbuflen); pwtmpbuf = (char *) __alloca (pwbuflen);
success = (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) success = 1;
>= 0); while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) < 0)
{
if (errno != ERANGE)
{
success = 0;
break;
}
pwbuflen *= 2;
pwtmpbuf = (char *) __alloca (pwbuflen);
__set_errno (0);
}
# else # else
p = getpwnam (name); p = getpwnam (name);
success = p != NULL; success = p != NULL;
@ -723,17 +733,23 @@ glob (pattern, flags, errfunc, pglob)
buflen = 1024; buflen = 1024;
pwtmpbuf = (char *) __alloca (buflen); pwtmpbuf = (char *) __alloca (buflen);
if (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0) while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) < 0)
home_dir = p->pw_dir; {
else if (errno != ERANGE)
home_dir = NULL; {
p = NULL;
break;
}
pwtmpbuf = __alloca (buflen *= 2);
__set_errno (0);
}
# else # else
p = getpwnam (user_name); p = getpwnam (user_name);
# endif
if (p != NULL) if (p != NULL)
home_dir = p->pw_dir; home_dir = p->pw_dir;
else else
home_dir = NULL; home_dir = NULL;
# endif
} }
/* If we found a home directory use this. */ /* If we found a home directory use this. */
if (home_dir != NULL) if (home_dir != NULL)