mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 11:20:07 +00:00
* misc/getusershell.c (initshells): Remove unnecessary tests.
(endusershell): Likewise. (okshells): Mark as const.
This commit is contained in:
parent
2094e1a975
commit
970362dc56
@ -1,5 +1,9 @@
|
|||||||
2005-12-20 Ulrich Drepper <drepper@redhat.com>
|
2005-12-20 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* misc/getusershell.c (initshells): Remove unnecessary tests.
|
||||||
|
(endusershell): Likewise.
|
||||||
|
(okshells): Mark as const.
|
||||||
|
|
||||||
* sysdeps/posix/gai_strerror.c: Complete rewrite. Avoid relocations.
|
* sysdeps/posix/gai_strerror.c: Complete rewrite. Avoid relocations.
|
||||||
* sysdeps/posix/gai_strerror-strs.h: New file.
|
* sysdeps/posix/gai_strerror-strs.h: New file.
|
||||||
* sysdeps/posix/Dist: New file.
|
* sysdeps/posix/Dist: New file.
|
||||||
|
@ -46,7 +46,7 @@ static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
|
|||||||
* /etc/shells.
|
* /etc/shells.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
|
static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
|
||||||
static char **curshell, **shells, *strings;
|
static char **curshell, **shells, *strings;
|
||||||
static char **initshells (void) __THROW;
|
static char **initshells (void) __THROW;
|
||||||
|
|
||||||
@ -70,11 +70,9 @@ void
|
|||||||
endusershell()
|
endusershell()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (shells != NULL)
|
free(shells);
|
||||||
free(shells);
|
|
||||||
shells = NULL;
|
shells = NULL;
|
||||||
if (strings != NULL)
|
free(strings);
|
||||||
free(strings);
|
|
||||||
strings = NULL;
|
strings = NULL;
|
||||||
curshell = NULL;
|
curshell = NULL;
|
||||||
}
|
}
|
||||||
@ -94,11 +92,9 @@ initshells()
|
|||||||
struct stat64 statb;
|
struct stat64 statb;
|
||||||
int flen;
|
int flen;
|
||||||
|
|
||||||
if (shells != NULL)
|
free(shells);
|
||||||
free(shells);
|
|
||||||
shells = NULL;
|
shells = NULL;
|
||||||
if (strings != NULL)
|
free(strings);
|
||||||
free(strings);
|
|
||||||
strings = NULL;
|
strings = NULL;
|
||||||
if ((fp = fopen(_PATH_SHELLS, "rc")) == NULL)
|
if ((fp = fopen(_PATH_SHELLS, "rc")) == NULL)
|
||||||
return (char **) okshells;
|
return (char **) okshells;
|
||||||
@ -117,8 +113,6 @@ initshells()
|
|||||||
strings = NULL;
|
strings = NULL;
|
||||||
return (char **) okshells;
|
return (char **) okshells;
|
||||||
}
|
}
|
||||||
/* No threads using this stream. */
|
|
||||||
__fsetlocking (fp, FSETLOCKING_BYCALLER);
|
|
||||||
sp = shells;
|
sp = shells;
|
||||||
cp = strings;
|
cp = strings;
|
||||||
flen = statb.st_size;
|
flen = statb.st_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user