aboutsummaryrefslogtreecommitdiff
path: root/string/strxfrm_l.c
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 /string/strxfrm_l.c
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 'string/strxfrm_l.c')
-rw-r--r--string/strxfrm_l.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c
index 20f2f149bd..5335601919 100644
--- a/string/strxfrm_l.c
+++ b/string/strxfrm_l.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 2002, 2004, 2005, 2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -97,7 +96,6 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
const int32_t *indirect;
uint_fast32_t pass;
size_t needed;
- size_t last_needed;
const USTRING_TYPE *usrc;
size_t srclen = STRLEN (src);
int32_t *idxarr;
@@ -199,7 +197,6 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
this is true for all of them. */
int position = rule & sort_position;
- last_needed = needed;
if (position == 0)
{
for (idxcnt = 0; idxcnt < idxmax; ++idxcnt)
@@ -429,11 +426,11 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
a `position' rule at the end and if no non-ignored character
is found the last \1 byte is immediately followed by a \0 byte
signalling this. We can avoid the \1 byte(s). */
- if (needed > 2 && needed == last_needed + 1)
+ if (needed <= n && needed > 2 && dest[needed - 2] == L('\1'))
{
/* Remove the \1 byte. */
- if (--needed <= n)
- dest[needed - 1] = L('\0');
+ --needed;
+ dest[needed - 1] = L('\0');
}
/* Free the memory if needed. */