aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog25
-rw-r--r--libio/tst-mmap-eofsync.c2
-rw-r--r--libio/tst-mmap-fflushsync.c2
-rw-r--r--libio/tst-mmap-offend.c2
-rw-r--r--libio/tst-mmap-setvbuf.c2
-rw-r--r--libio/tst-mmap2-eofsync.c2
-rw-r--r--locale/duplocale.c26
-rw-r--r--locale/freelocale.c11
-rw-r--r--locale/global-locale.c8
-rw-r--r--locale/localeinfo.h4
-rw-r--r--locale/localename.c15
-rw-r--r--locale/setlocale.c24
-rw-r--r--locale/xlocale.c8
-rw-r--r--locale/xlocale.h3
-rwxr-xr-xscripts/cpp24
-rw-r--r--sunrpc/Makefile2
-rw-r--r--sysdeps/gnu/errlist-compat.awk6
17 files changed, 105 insertions, 61 deletions
diff --git a/ChangeLog b/ChangeLog
index f6e061a..1f48463 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,30 @@
2002-08-30 Roland McGrath <roland@redhat.com>
+ * locale/xlocale.h (struct __locale_struct): New member `__names'.
+ * locale/xlocale.c (_nl_C_locobj): Update initializer.
+ * locale/global-locale.c (_nl_global_locale): Likewise.
+ * locale/duplocale.c (__duplocale): strdup __names elements.
+ * locale/freelocale.c (__freelocale): Free __names elements.
+ * locale/localename.c (_nl_current_names): Variable removed.
+ (__current_locale_name): Use _NL_CURRENT_LOCALE->__names instead.
+ * locale/localeinfo.h (_nl_current_names): Removed decl.
+ * locale/setlocale.c: Use _nl_global_locale->__names in place of
+ _nl_current_names throughout.
+
+ * locale/setlocale.c (setlocale): strdup -> __strdup (not ISO C).
+
+ * sysdeps/gnu/errlist-compat.awk: Emit link_warnings for sys_errlist
+ and sys_nerr in the output file.
+
+ * sunrpc/Makefile (rpcgen-cmd): Pass CPP in rpcgen's environment.
+ * scripts/cpp: Just use the environment variable.
+
+ * libio/tst-mmap-setvbuf.c (main): Use 'm' fopen flag.
+ * libio/tst-mmap-offend.c (do_test): Likewise.
+ * libio/tst-mmap-fflushsync.c (do_test): Likewise.
+ * libio/tst-mmap-eofsync.c (do_test): Likewise.
+ * libio/tst-mmap2-eofsync.c (do_test): Likewise.
+
* locale/localename.c: If the current locale is the global locale, use
_nl_current_names; otherwise use the locale object.
diff --git a/libio/tst-mmap-eofsync.c b/libio/tst-mmap-eofsync.c
index 7374836..e8ef727 100644
--- a/libio/tst-mmap-eofsync.c
+++ b/libio/tst-mmap-eofsync.c
@@ -38,7 +38,7 @@ do_test (void)
int result = 0;
int c;
- f = fopen (temp_file, "r");
+ f = fopen (temp_file, "rm");
if (f == NULL)
{
perror (temp_file);
diff --git a/libio/tst-mmap-fflushsync.c b/libio/tst-mmap-fflushsync.c
index a4580e9..24ae33c 100644
--- a/libio/tst-mmap-fflushsync.c
+++ b/libio/tst-mmap-fflushsync.c
@@ -38,7 +38,7 @@ do_test (void)
int result = 0;
int c;
- f = fopen (temp_file, "r");
+ f = fopen (temp_file, "rm");
if (f == NULL)
{
perror (temp_file);
diff --git a/libio/tst-mmap-offend.c b/libio/tst-mmap-offend.c
index 2025f1d..19732e6 100644
--- a/libio/tst-mmap-offend.c
+++ b/libio/tst-mmap-offend.c
@@ -34,7 +34,7 @@ do_test (void)
{
unsigned char buffer[8192];
int result = 0;
- FILE *f = fopen (temp_file, "r");
+ FILE *f = fopen (temp_file, "rm");
size_t cc;
if (f == NULL)
diff --git a/libio/tst-mmap-setvbuf.c b/libio/tst-mmap-setvbuf.c
index 47854b7..3512357 100644
--- a/libio/tst-mmap-setvbuf.c
+++ b/libio/tst-mmap-setvbuf.c
@@ -48,7 +48,7 @@ int main (void)
fputs (test, f);
fclose (f);
- f = fopen (name, "r");
+ f = fopen (name, "rm");
if (f == NULL)
{
printf ("%u: cannot fopen temporary file: %m\n", __LINE__);
diff --git a/libio/tst-mmap2-eofsync.c b/libio/tst-mmap2-eofsync.c
index aefe472..60bad94 100644
--- a/libio/tst-mmap2-eofsync.c
+++ b/libio/tst-mmap2-eofsync.c
@@ -44,7 +44,7 @@ do_test (void)
int result = 0;
int c;
- f = fopen (temp_file, "r");
+ f = fopen (temp_file, "rm");
if (f == NULL)
{
perror (temp_file);
diff --git a/locale/duplocale.c b/locale/duplocale.c
index f8e8e72..df856a2 100644
--- a/locale/duplocale.c
+++ b/locale/duplocale.c
@@ -33,15 +33,39 @@ __locale_t
__duplocale (__locale_t dataset)
{
__locale_t result;
+ int cnt;
/* We modify global data. */
__libc_lock_lock (__libc_setlocale_lock);
/* Get memory. */
result = (__locale_t) malloc (sizeof (struct __locale_struct));
+
+ if (result != NULL)
+ /* Duplicate the names in a separate loop first so we can
+ bail out if strdup fails and not have touched usage_counts. */
+ for (cnt = 0; cnt < __LC_LAST; ++cnt)
+ if (cnt != LC_ALL)
+ {
+ if (dataset->__names[cnt] == _nl_C_name)
+ result->__names[cnt] = _nl_C_name;
+ else
+ {
+ result->__names[cnt] = __strdup (dataset->__names[cnt]);
+ if (result->__names[cnt] == NULL)
+ {
+ while (cnt-- > 0)
+ if (dataset->__names[cnt] != _nl_C_name)
+ free ((char *) dataset->__names[cnt]);
+ free (result);
+ result = NULL;
+ break;
+ }
+ }
+ }
+
if (result != NULL)
{
- int cnt;
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL)
{
diff --git a/locale/freelocale.c b/locale/freelocale.c
index de7e554..2ba1432 100644
--- a/locale/freelocale.c
+++ b/locale/freelocale.c
@@ -38,9 +38,14 @@ __freelocale (__locale_t dataset)
__libc_lock_lock (__libc_setlocale_lock);
for (cnt = 0; cnt < __LC_LAST; ++cnt)
- if (cnt != LC_ALL && dataset->__locales[cnt]->usage_count != UNDELETABLE)
- /* We can remove the data. */
- _nl_remove_locale (cnt, dataset->__locales[cnt]);
+ if (cnt != LC_ALL)
+ {
+ if (dataset->__locales[cnt]->usage_count != UNDELETABLE)
+ /* We can remove the data. */
+ _nl_remove_locale (cnt, dataset->__locales[cnt]);
+ if (dataset->__names[cnt] != _nl_C_name)
+ free ((char *) dataset->__names[cnt]);
+ }
/* Free the locale_t handle itself. */
free (dataset);
diff --git a/locale/global-locale.c b/locale/global-locale.c
index bec7498..a5cae3c 100644
--- a/locale/global-locale.c
+++ b/locale/global-locale.c
@@ -46,6 +46,14 @@ struct __locale_struct _nl_global_locale attribute_hidden =
#include "categories.def"
#undef DEFINE_CATEGORY
},
+ .__names =
+ {
+ [LC_ALL] = _nl_C_name,
+#define DEFINE_CATEGORY(category, category_name, items, a) \
+ [category] = _nl_C_name,
+#include "categories.def"
+#undef DEFINE_CATEGORY
+ },
.__ctype_b = (const unsigned short int *) _nl_C_LC_CTYPE_class + 128,
.__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
.__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 186aa71..c235fb8 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -177,10 +177,6 @@ extern const char _nl_POSIX_name[] attribute_hidden;
/* The standard codeset. */
extern const char _nl_C_codeset[] attribute_hidden;
-/* Name of current locale for each individual category.
- Each is malloc'd unless it is _nl_C_name. */
-extern const char *_nl_current_names[] attribute_hidden;
-
/* This is the internal locale_t object that holds the global locale
controlled by calls to setlocale. A thread's TSD locale pointer
points to this when `uselocale (LC_GLOBAL_LOCALE)' is in effect. */
diff --git a/locale/localename.c b/locale/localename.c
index 377ec29..845cfb0 100644
--- a/locale/localename.c
+++ b/locale/localename.c
@@ -19,22 +19,9 @@
#include "localeinfo.h"
-/* Name of current locale for each individual category.
- Each is malloc'd unless it is _nl_C_name. */
-const char *_nl_current_names[] attribute_hidden =
- {
-#define DEFINE_CATEGORY(category, category_name, items, a) \
- [category] = _nl_C_name,
-#include "categories.def"
-#undef DEFINE_CATEGORY
- [LC_ALL] = _nl_C_name /* For LC_ALL. */
- };
-
const char *
attribute_hidden
__current_locale_name (int category)
{
- return (_NL_CURRENT_LOCALE == &_nl_global_locale
- ? _nl_current_names[category]
- : _NL_CURRENT_LOCALE->__locales[category]->name);
+ return _NL_CURRENT_LOCALE->__names[category];
}
diff --git a/locale/setlocale.c b/locale/setlocale.c
index c64db08..a48f171 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -136,7 +136,7 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
{
const char *name = (category == LC_ALL ? newnames[i] :
category == i ? newnames[0] :
- _nl_current_names[i]);
+ _nl_global_locale.__names[i]);
last_len = strlen (name);
cumlen += _nl_category_name_sizes[i] + 1 + last_len + 1;
if (i > 0 && same && strcmp (name, newnames[0]) != 0)
@@ -165,7 +165,7 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
/* Add "CATEGORY=NAME;" to the string. */
const char *name = (category == LC_ALL ? newnames[i] :
category == i ? newnames[0] :
- _nl_current_names[i]);
+ _nl_global_locale.__names[i]);
p = __stpcpy (p, _nl_category_names[i]);
*p++ = '=';
p = __stpcpy (p, name);
@@ -176,17 +176,17 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
}
-/* Put NAME in _nl_current_names. */
+/* Put NAME in _nl_global_locale.__names. */
static inline void
setname (int category, const char *name)
{
- if (_nl_current_names[category] == name)
+ if (_nl_global_locale.__names[category] == name)
return;
- if (_nl_current_names[category] != _nl_C_name)
- free ((char *) _nl_current_names[category]);
+ if (_nl_global_locale.__names[category] != _nl_C_name)
+ free ((char *) _nl_global_locale.__names[category]);
- _nl_current_names[category] = name;
+ _nl_global_locale.__names[category] = name;
}
/* Put DATA in *_nl_current[CATEGORY]. */
@@ -216,11 +216,11 @@ setlocale (int category, const char *locale)
/* Does user want name of current locale? */
if (locale == NULL)
- return (char *) _nl_current_names[category];
+ return (char *) _nl_global_locale.__names[category];
- if (strcmp (locale, _nl_current_names[category]) == 0)
+ if (strcmp (locale, _nl_global_locale.__names[category]) == 0)
/* Changing to the same thing. */
- return (char *) _nl_current_names[category];
+ return (char *) _nl_global_locale.__names[category];
/* We perhaps really have to load some data. So we determine the
path in which to look for the data now. The environment variable
@@ -324,7 +324,7 @@ setlocale (int category, const char *locale)
/* Make a copy of locale name. */
if (newnames[category] != _nl_C_name)
{
- newnames[category] = strdup (newnames[category]);
+ newnames[category] = __strdup (newnames[category]);
if (newnames[category] == NULL)
break;
}
@@ -389,7 +389,7 @@ setlocale (int category, const char *locale)
/* Make a copy of locale name. */
if (newname[0] != _nl_C_name)
{
- newname[0] = strdup (newname[0]);
+ newname[0] = __strdup (newname[0]);
if (newname[0] == NULL)
goto abort_single;
}
diff --git a/locale/xlocale.c b/locale/xlocale.c
index 2f9e198..d9d3442 100644
--- a/locale/xlocale.c
+++ b/locale/xlocale.c
@@ -41,6 +41,14 @@ struct __locale_struct _nl_C_locobj attribute_hidden =
#include "categories.def"
#undef DEFINE_CATEGORY
},
+ .__names =
+ {
+ [LC_ALL] = _nl_C_name,
+#define DEFINE_CATEGORY(category, category_name, items, a) \
+ [category] = _nl_C_name,
+#include "categories.def"
+#undef DEFINE_CATEGORY
+ },
.__ctype_b = (const unsigned short int *) _nl_C_LC_CTYPE_class + 128,
.__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
.__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
diff --git a/locale/xlocale.h b/locale/xlocale.h
index fa65e10..4fb557d 100644
--- a/locale/xlocale.h
+++ b/locale/xlocale.h
@@ -1,5 +1,5 @@
/* Definition of locale datatype.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997,2000,02 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -29,6 +29,7 @@ typedef struct __locale_struct
{
/* Note: LC_ALL is not a valid index into this array. */
struct locale_data *__locales[13]; /* 13 = __LC_LAST. */
+ const char *__names[13];
/* To increase the speed of this solution we add some special members. */
const unsigned short int *__ctype_b;
diff --git a/scripts/cpp b/scripts/cpp
index 24112c6..65f273e 100755
--- a/scripts/cpp
+++ b/scripts/cpp
@@ -1,22 +1,6 @@
#! /bin/sh
-cpp=`which cpp 2>/dev/null`
-if test $? -ne 0; then
- if type cpp 2>/dev/null >/dev/null; then
- cpp=`type cpp 2>/dev/null | awk '{ print $NF }'`
- else
- cpp=`gcc -print-file-name=cpp 2>/dev/null`
- if test $? -ne 0; then
- if test -x /lib/cpp; then
- cpp=/lib/cpp
- else
- echo "cpp not found" 1>&2
- exit 1
- fi
- fi
- fi
-fi
-exec $cpp $*
-Local Variables:
-mode: sh
-End:
+# This script is used solely by rpcgen when run by sunrpc/Makefile,
+# which passes CPP in the environment to tell us what to run.
+
+exec ${CPP} "$@"
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index b3e71ad..f2c31c7 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -132,7 +132,7 @@ $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
$(+link)
# Tell rpcgen where to find the C preprocessor.
-rpcgen-cmd = $(built-program-cmd) -Y ../scripts
+rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
# Install the rpc data base file.
$(inst_sysconfdir)/rpc: etc.rpc $(+force)
diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
index 4ab9786..b243a96 100644
--- a/sysdeps/gnu/errlist-compat.awk
+++ b/sysdeps/gnu/errlist-compat.awk
@@ -113,4 +113,10 @@ versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, %s);\n\
versioned_symbol (libc, _sys_nerr_internal, sys_nerr, %s);\n\
versioned_symbol (libc, __sys_nerr_internal, _sys_nerr, %s);\n", \
lastv, lastv, lastv, lastv;
+
+ print "\n\
+link_warning (sys_errlist, \"\
+`sys_errlist' is deprecated; use `strerror' or `strerror_r' instead\")\n\
+link_warning (sys_nerr, \"\
+`sys_nerr' is deprecated; use `strerror' or `strerror_r' instead\")";
}