summaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-01-12 14:37:24 +0000
committerJakub Jelinek <jakub@redhat.com>2007-01-12 14:37:24 +0000
commit00e3dec8025c93ccde8ed810657e7f2115ddc8cb (patch)
tree30b8f6bdb08d364b986ae3ec3ec7664c520f0ad9 /stdlib
parentd6220e9ee38c1c9285221b023346201ec5f511b3 (diff)
downloadglibc-00e3dec8025c93ccde8ed810657e7f2115ddc8cb.tar
glibc-00e3dec8025c93ccde8ed810657e7f2115ddc8cb.tar.gz
glibc-00e3dec8025c93ccde8ed810657e7f2115ddc8cb.tar.bz2
glibc-00e3dec8025c93ccde8ed810657e7f2115ddc8cb.zip
* nis/nis_table.c (nis_list): If __follow_path fails in the new
code, make sure the nis_freeresult call doesn't crash and that the result is reported correctly. * nis/nis_table.c (nis_list): Handle FOLLOW_PATH | ALL_RESULTS when callback is NULL. * nis/Versions (libnss_nisplus): Add _nss_nisplus_initgroups_dyn@@GLIBC_PRIVATE. * nis/Makefile (libnss_nisplus-routines): Add nisplus-initgroups. * nis/nss_nisplus/nisplus-grp.c (tablename_val, tablename_len, _nss_create_tablename): Rename to... (grp_tablename_val, grp_tablename_len, _nss_grp_create_tablename): ... these. No longer static. (internal_setgrent): Adjust users. (_nss_nisplus_getgrnam_r, _nss_nisplus_getgrgid_r): Likewise. Don't use locking around _nss_grp_create_tablename call. * nis/nss_nisplus/nisplus-initgroups.c: New file.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/Makefile12
-rw-r--r--stdlib/atexit.c11
-rw-r--r--stdlib/cxa_finalize.c4
-rw-r--r--stdlib/jrand48_r.c4
-rw-r--r--stdlib/stdlib.h3
-rw-r--r--stdlib/strtod_l.c58
-rw-r--r--stdlib/tst-rand48.c28
7 files changed, 55 insertions, 65 deletions
diff --git a/stdlib/Makefile b/stdlib/Makefile
index b4518b2bb3..e632d3523b 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -66,9 +66,7 @@ tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
test-canon test-canon2 tst-strtoll tst-environ \
tst-xpg-basename tst-random tst-random2 tst-bsearch \
tst-limits tst-rand48 bug-strtod tst-setcontext \
- test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
- tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
- tst-makecontext tst-strtod4
+ test-a64l tst-qsort tst-system testmb2 bug-strtod2
include ../Makeconfig
@@ -104,6 +102,10 @@ CFLAGS-strfmon.c = -D_IO_MTSAFE_IO
CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO
endif
+ifeq (yes,$(have-protected))
+CFLAGS-atexit.c = -DHAVE_DOT_HIDDEN
+endif
+
CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
CFLAGS-tst-qsort.c = $(stack-align-test-flags)
@@ -113,8 +115,6 @@ include ../Rules
test-canon-ARGS = --test-dir=${common-objpfx}stdlib
tst-strtod-ENV = LOCPATH=$(common-objpfx)localedata
-tst-strtod3-ENV = LOCPATH=$(common-objpfx)localedata
-tst-strtod4-ENV = LOCPATH=$(common-objpfx)localedata
testmb2-ENV = LOCPATH=$(common-objpfx)localedata
# Run a test on the header files we use.
diff --git a/stdlib/atexit.c b/stdlib/atexit.c
index 256c5fcfc0..307662bdcd 100644
--- a/stdlib/atexit.c
+++ b/stdlib/atexit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1999, 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -43,11 +43,14 @@ extern void *__dso_handle __attribute__ ((__weak__));
/* Register FUNC to be executed by `exit'. */
int
-#ifndef atexit
-attribute_hidden
-#endif
atexit (void (*func) (void))
{
return __cxa_atexit ((void (*) (void *)) func, NULL,
&__dso_handle == NULL ? NULL : __dso_handle);
}
+
+/* Hide the symbol so that no definition but the one locally in the
+ executable or DSO is used. */
+#ifdef HAVE_DOT_HIDDEN
+asm (".hidden\tatexit");
+#endif
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index 148d57f200..bb49f36ddd 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -45,8 +45,8 @@ __cxa_finalize (void *d)
/* We don't want to run this cleanup more than once. */
&& (cxafn = f->func.cxa.fn,
cxaarg = f->func.cxa.arg,
- ! catomic_compare_and_exchange_bool_acq (&f->flavor, ef_free,
- ef_cxa)))
+ ! atomic_compare_and_exchange_bool_acq (&f->flavor, ef_free,
+ ef_cxa)))
{
uint64_t check = __new_exitfn_called;
diff --git a/stdlib/jrand48_r.c b/stdlib/jrand48_r.c
index 39e8d090a6..2383ae129e 100644
--- a/stdlib/jrand48_r.c
+++ b/stdlib/jrand48_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
@@ -30,7 +30,7 @@ __jrand48_r (xsubi, buffer, result)
return -1;
/* Store the result. */
- *result = (int32_t) ((xsubi[2] << 16) | xsubi[1]);
+ *result = ((xsubi[2] << 16) | xsubi[1]) & 0xffffffffl;
return 0;
}
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 7b39bc018a..c3fc14562e 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -741,7 +741,8 @@ __END_NAMESPACE_STD
#ifdef __USE_GNU
/* Return a malloc'd string containing the canonical absolute name of the
- existing named file. */
+ named file. The last file name component need not exist, and may be a
+ symlink to a nonexistent file. */
extern char *canonicalize_file_name (__const char *__name)
__THROW __nonnull ((1)) __wur;
#endif
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index bb7493bff0..e13f1086da 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -1,6 +1,5 @@
/* Convert string representing a number to float value, using given locale.
- Copyright (C) 1997,1998,2002,2004,2005,2006,2007
- Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2002,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -651,11 +650,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
if (c != '0')
{
for (cnt = 0; thousands[cnt] != '\0'; ++cnt)
- if (thousands[cnt] != cp[cnt])
+ if (c != thousands[cnt])
break;
if (thousands[cnt] != '\0')
break;
- cp += cnt - 1;
}
c = *++cp;
}
@@ -664,29 +662,20 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* If no other digit but a '0' is found the result is 0.0.
Return current read pointer. */
- if (!((c >= L_('0') && c <= L_('9'))
- || (base == 16 && ((CHAR_TYPE) TOLOWER (c) >= L_('a')
- && (CHAR_TYPE) TOLOWER (c) <= L_('f')))
- || (
+ if ((c < L_('0') || c > L_('9'))
+ && (base == 16 && (c < (CHAR_TYPE) TOLOWER (L_('a'))
+ || c > (CHAR_TYPE) TOLOWER (L_('f'))))
#ifdef USE_WIDE_CHAR
- c == (wint_t) decimal
+ && c != (wint_t) decimal
#else
- ({ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
- if (decimal[cnt] != cp[cnt])
- break;
- decimal[cnt] == '\0'; })
+ && ({ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
+ if (decimal[cnt] != cp[cnt])
+ break;
+ decimal[cnt] != '\0'; })
#endif
- /* '0x.' alone is not a valid hexadecimal number.
- '.' alone is not valid either, but that has been checked
- already earlier. */
- && (base != 16
- || cp != start_of_digits
- || (cp[decimal_len] >= L_('0') && cp[decimal_len] <= L_('9'))
- || ((CHAR_TYPE) TOLOWER (cp[decimal_len]) >= L_('a')
- && (CHAR_TYPE) TOLOWER (cp[decimal_len]) <= L_('f'))))
- || (base == 16 && (cp != start_of_digits
- && (CHAR_TYPE) TOLOWER (c) == L_('p')))
- || (base != 16 && (CHAR_TYPE) TOLOWER (c) == L_('e'))))
+ && (base == 16 && (cp == start_of_digits
+ || (CHAR_TYPE) TOLOWER (c) != L_('p')))
+ && (base != 16 && (CHAR_TYPE) TOLOWER (c) != L_('e')))
{
#ifdef USE_WIDE_CHAR
tp = __correctly_grouped_prefixwc (start_of_digits, cp, thousands,
@@ -726,14 +715,13 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
break;
if (thousands[cnt] != '\0')
break;
- cp += cnt - 1;
}
#endif
}
c = *++cp;
}
- if (grouping && cp > start_of_digits)
+ if (grouping && dig_no > 0)
{
/* Check the grouping of the digits. */
#ifdef USE_WIDE_CHAR
@@ -771,15 +759,13 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
}
}
- /* We have the number of digits in the integer part. Whether these
- are all or any is really a fractional digit will be decided
- later. */
+ /* We have the number digits in the integer part. Whether these are all or
+ any is really a fractional digit will be decided later. */
int_no = dig_no;
lead_zero = int_no == 0 ? -1 : 0;
- /* Read the fractional digits. A special case are the 'american
- style' numbers like `16.' i.e. with decimal point but without
- trailing digits. */
+ /* Read the fractional digits. A special case are the 'american style'
+ numbers like `16.' i.e. with decimal but without trailing digits. */
if (
#ifdef USE_WIDE_CHAR
c == (wint_t) decimal
@@ -829,16 +815,15 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
if (base == 16)
exp_limit = (exp_negative ?
-MIN_EXP + MANT_DIG + 4 * int_no :
- MAX_EXP - 4 * int_no + 4 * lead_zero + 3);
+ MAX_EXP - 4 * int_no + lead_zero);
else
exp_limit = (exp_negative ?
-MIN_10_EXP + MANT_DIG + int_no :
- MAX_10_EXP - int_no + lead_zero + 1);
+ MAX_10_EXP - int_no + lead_zero);
do
{
exponent *= 10;
- exponent += c - L_('0');
if (exponent > exp_limit)
/* The exponent is too large/small to represent a valid
@@ -868,6 +853,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
/* NOTREACHED */
}
+ exponent += c - L_('0');
c = *++cp;
}
while (c >= L_('0') && c <= L_('9'));
@@ -902,7 +888,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
--expp;
--dig_no;
--int_no;
- exponent += base == 16 ? 4 : 1;
+ ++exponent;
}
while (dig_no > 0 && exponent < 0);
diff --git a/stdlib/tst-rand48.c b/stdlib/tst-rand48.c
index 52e1b96afe..fd2c4c1955 100644
--- a/stdlib/tst-rand48.c
+++ b/stdlib/tst-rand48.c
@@ -44,10 +44,10 @@ main (void)
}
l = mrand48 ();
- if (l != -0x5d73effdl)
+ if (l != 0xa28c1003l)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, -0x5d73effdl, l);
+ __LINE__ - 4, 0xa28c1003l, l);
result = 1;
}
@@ -60,10 +60,10 @@ main (void)
}
l = mrand48 ();
- if (l != -0x61770b8cl)
+ if (l != 0x9e88f474l)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, -0x61770b8cl, l);
+ __LINE__ - 4, 0x9e88f474l, l);
result = 1;
}
@@ -92,10 +92,10 @@ main (void)
}
l = mrand48 ();
- if (l != -0x1485e05dl)
+ if (l != 0xeb7a1fa3l)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, -0x1485e05dl, l);
+ __LINE__ - 4, 0xeb7a1fa3l, l);
result = 1;
}
@@ -171,10 +171,10 @@ main (void)
}
l = mrand48 ();
- if (l != -0x5d73effdl)
+ if (l != 0xa28c1003l)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, -0x5d73effdl, l);
+ __LINE__ - 4, 0xa28c1003l, l);
result = 1;
}
@@ -187,10 +187,10 @@ main (void)
}
l = mrand48 ();
- if (l != -0x61770b8cl)
+ if (l != 0x9e88f474l)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, -0x61770b8cl, l);
+ __LINE__ - 4, 0x9e88f474l, l);
result = 1;
}
@@ -231,10 +231,10 @@ main (void)
}
l = mrand48 ();
- if (l != -0x1485e05dl)
+ if (l != 0xeb7a1fa3l)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, -0x1485e05dl, l);
+ __LINE__ - 4, 0xeb7a1fa3l, l);
result = 1;
}
@@ -287,10 +287,10 @@ main (void)
}
l = jrand48 (xs);
- if (l != -0xa973860l)
+ if (l != 0xf568c7a0l)
{
printf ("jrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, -0xa973860l, l);
+ __LINE__ - 4, 0xf568c7a0l, l);
result = 1;
}