mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Update.
Thu Aug 8 16:17:38 1996 Ulrich Drepper <drepper@cygnus.com> * pwd/getpwent.c: Define BUFLEN from NSS_BUFLEN_PASSWD. * pwd/getpwent_r.c: Likewise. * pwd/getpwnam.c: Likewise. * pwd/getpwnam_r.c: Likewise. * pwd/getpwuid.c: Likewise. * pwd/getpwuid_r.c: Likewise. * grp/getgrent.c: Define BUFLEN from NSS_BUFLEN_GROUP. * grp/getgrent_r.c: Likewise. * grp/getgrgid.c: Likewise. * grp/getgrgid_r.c: Likewise. * grp/getgrnam.c: Likewise. * pwd/fgetpwent_r.c: New file. Reentrant version of fgetpwent. * pwd/fgetpwent.c: Rewrite to use fgetpwent_r. * pwd/Makefile (routines): Add fgetpwent_r. * pwd/pwd.h: Add prototypes for __fgetpwent_r and fgetpwent_r. * grp/fgetgrent_r.c: New file. Reentrant version of fgetgrent. * grp/fgetgrent.c: Rewrite to use fgetgrent_r. * grp/Makefile (routines): Add fgetgrent_r. * grp/grp.h: Add prototypes for __fgetgrent_r and fgetgrent_r. Implement shadow password lookup functions. This is no complete shadow password suite. * shadow/Makefile: New file. * shadow/fgetspent.c: New file. * shadow/fgetspent_r.c: New file. * shadow/getspent.c: New file. * shadow/getspent_r.c: New file. * shadow/getspnam.c: New file. * shadow/getspnam_r.c: New file. * shadow/putspent.c: New file. * shadow/sgetspent.c: New file. * shadow/sgetspent_r.c: New file. * shadow/shadow.h: New file. * shadow/spwd-lookup.c: New file. * shadow/nss_files/files-spwd.c: New file. Thu Aug 8 13:33:45 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/ftime.c: New file. Available system call is only a stub. Reported by Matthias Urlichs. * Makeconfig [!default_cflags]: Change default value from `-g' to `-g -O'. * configure.in: Recognize i686. * sysdeps/i386/i686/Implies: Default on i586 optimized code. Thu Aug 8 12:40:20 1996 Matthias Urlichs <smurf@smurf.noris.de> * Makeconfig [$(build-omitfp) == yes]: Add to CFLAGS-.so value of CFLAGS-.o, not CFLAGS-o. * sysdeps/unix/sysv/linux/init-first.c (init): Add volatile pointer to ourself. Otherwise `gcc -O3' optimized init away. sure that all tables in binary file are word-aligned.
This commit is contained in:
@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include <alloca.h>
|
||||
#include <argz.h>
|
||||
#include <errno.h>
|
||||
#include <libc-lock.h>
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -93,7 +94,7 @@ extern void postload (void);
|
||||
|
||||
/* Define an array indexed by category of postload functions to call after
|
||||
loading and installing that category's data. */
|
||||
void (*const _nl_category_postload[]) (void) =
|
||||
static void (*const _nl_category_postload[]) (void) =
|
||||
{
|
||||
#define DEFINE_CATEGORY(category, category_name, items, postload, b, c, d) \
|
||||
[category] = postload,
|
||||
@ -114,6 +115,9 @@ static const char *_nl_current_names[] =
|
||||
};
|
||||
|
||||
|
||||
/* Lock for protecting global data. */
|
||||
__libc_lock_define_initialized (static, lock)
|
||||
|
||||
|
||||
/* Use this when we come along an error. */
|
||||
#define ERROR_RETURN \
|
||||
@ -238,8 +242,8 @@ setlocale (int category, const char *locale)
|
||||
return (char *) _nl_current_names[category];
|
||||
|
||||
/* We perhaps really have to load some data. So we determine the
|
||||
path in which to look for the data now. But this environment
|
||||
variable must only be used when the binary has no SUID or SGID
|
||||
path in which to look for the data now. The environment variable
|
||||
`LOCPATH' must only be used when the binary has no SUID or SGID
|
||||
bit set. */
|
||||
locale_path = NULL;
|
||||
locale_path_len = 0;
|
||||
@ -309,6 +313,9 @@ setlocale (int category, const char *locale)
|
||||
ERROR_RETURN;
|
||||
}
|
||||
|
||||
/* Protect global data. */
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
/* Load the new data for each category. */
|
||||
while (category-- > 0)
|
||||
/* Only actually load the data if anything will use it. */
|
||||
@ -319,25 +326,7 @@ setlocale (int category, const char *locale)
|
||||
&newnames[category]);
|
||||
|
||||
if (newdata[category] == NULL)
|
||||
{
|
||||
/* Loading this part of the locale failed. Abort the
|
||||
composite load. */
|
||||
int save_errno;
|
||||
abort_composite:
|
||||
save_errno = errno;
|
||||
|
||||
while (++category < LC_ALL)
|
||||
if (_nl_current[category] != NULL
|
||||
&& newdata[category] != _nl_C[category])
|
||||
_nl_free_locale (newdata[category]);
|
||||
else
|
||||
if (_nl_current[category] == NULL
|
||||
&& newnames[category] != _nl_C_name)
|
||||
free (newnames[category]);
|
||||
|
||||
errno = save_errno;
|
||||
return NULL;
|
||||
}
|
||||
goto abort_composite;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -351,17 +340,39 @@ setlocale (int category, const char *locale)
|
||||
composite = new_composite_name (LC_ALL, newnames);
|
||||
if (composite == NULL)
|
||||
{
|
||||
/* Loading this part of the locale failed. Abort the
|
||||
composite load. */
|
||||
int save_errno;
|
||||
|
||||
category = -1;
|
||||
goto abort_composite;
|
||||
abort_composite:
|
||||
save_errno = errno;
|
||||
|
||||
while (++category < LC_ALL)
|
||||
if (_nl_current[category] != NULL
|
||||
&& newdata[category] != _nl_C[category])
|
||||
_nl_free_locale (newdata[category]);
|
||||
else
|
||||
if (_nl_current[category] == NULL
|
||||
&& newnames[category] != _nl_C_name)
|
||||
free (newnames[category]);
|
||||
|
||||
errno = save_errno;
|
||||
composite = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Now we have loaded all the new data. Put it in place. */
|
||||
for (category = 0; category < LC_ALL; ++category)
|
||||
{
|
||||
setdata (category, newdata[category]);
|
||||
setname (category, newnames[category]);
|
||||
}
|
||||
setname (LC_ALL, composite);
|
||||
}
|
||||
|
||||
/* Now we have loaded all the new data. Put it in place. */
|
||||
for (category = 0; category < LC_ALL; ++category)
|
||||
{
|
||||
setdata (category, newdata[category]);
|
||||
setname (category, newnames[category]);
|
||||
}
|
||||
setname (LC_ALL, composite);
|
||||
/* Critical section left. */
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
return composite;
|
||||
}
|
||||
@ -370,6 +381,9 @@ setlocale (int category, const char *locale)
|
||||
const struct locale_data *newdata = NULL;
|
||||
char *newname = NULL;
|
||||
|
||||
/* Protect global data. */
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
if (_nl_current[category] != NULL)
|
||||
{
|
||||
/* Only actually load the data if anything will use it. */
|
||||
@ -377,7 +391,7 @@ setlocale (int category, const char *locale)
|
||||
newdata = _nl_find_locale (locale_path, locale_path_len, category,
|
||||
(char **) &newname);
|
||||
if (newdata == NULL)
|
||||
return NULL;
|
||||
goto abort_single;
|
||||
}
|
||||
|
||||
/* Create new composite name. */
|
||||
@ -392,14 +406,20 @@ setlocale (int category, const char *locale)
|
||||
_nl_free_locale (newdata);
|
||||
|
||||
errno = save_errno;
|
||||
return NULL;
|
||||
abort_single:
|
||||
newname = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_nl_current[category] != NULL)
|
||||
setdata (category, newdata);
|
||||
|
||||
setname (category, newname);
|
||||
setname (LC_ALL, composite);
|
||||
}
|
||||
|
||||
if (_nl_current[category] != NULL)
|
||||
setdata (category, newdata);
|
||||
|
||||
setname (category, newname);
|
||||
setname (LC_ALL, composite);
|
||||
/* Critical section left. */
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
return newname;
|
||||
}
|
||||
|
Reference in New Issue
Block a user