[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r5679 - in /trunk: libc/ libc/debug/ libc/dlfcn/ libc/elf/ libc/gmon/ libc/hurd/ libc/iconv/ libc/include/ libc/inet/ libc/i...



Author: joseph
Date: Thu Mar 27 06:22:15 2008
New Revision: 5679

Log:
Merge changes between r5247 and r5678 from /fsf/trunk.

Added:
    trunk/libc/debug/asprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/debug/asprintf_chk.c
    trunk/libc/debug/dprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/debug/dprintf_chk.c
    trunk/libc/debug/obprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/debug/obprintf_chk.c
    trunk/libc/debug/vasprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/debug/vasprintf_chk.c
    trunk/libc/debug/vdprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/debug/vdprintf_chk.c
    trunk/libc/localedata/locales/shs_CA
      - copied unchanged from r5678, fsf/trunk/libc/localedata/locales/shs_CA
    trunk/libc/po/vi.po
      - copied unchanged from r5678, fsf/trunk/libc/po/vi.po
    trunk/libc/stdlib/tens_in_limb.c
      - copied unchanged from r5678, fsf/trunk/libc/stdlib/tens_in_limb.c
    trunk/libc/stdlib/tst-strtod6.c
      - copied unchanged from r5678, fsf/trunk/libc/stdlib/tst-strtod6.c
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-asprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-asprintf_chk.c
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-dprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-dprintf_chk.c
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf_chk.c
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf_chk.c
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf_chk.c
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf_chk.c
      - copied unchanged from r5678, fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf_chk.c
    trunk/libc/sysdeps/x86_64/rtld-memset.c
      - copied unchanged from r5678, fsf/trunk/libc/sysdeps/x86_64/rtld-memset.c
    trunk/ports/sysdeps/unix/sysv/linux/hppa/sys/user.h
      - copied unchanged from r5678, fsf/trunk/ports/sysdeps/unix/sysv/linux/hppa/sys/user.h
Removed:
    trunk/ports/sysdeps/unix/sysv/linux/hppa/Makefile
Modified:
    trunk/libc/ChangeLog
    trunk/libc/FAQ
    trunk/libc/FAQ.in
    trunk/libc/debug/Makefile
    trunk/libc/debug/Versions
    trunk/libc/debug/tst-chk1.c
    trunk/libc/dlfcn/dlinfo.c
    trunk/libc/elf/Makefile
    trunk/libc/elf/Versions
    trunk/libc/elf/dl-iteratephdr.c
    trunk/libc/elf/dl-sysdep.c
    trunk/libc/elf/dl-tls.c
    trunk/libc/elf/ldconfig.c
    trunk/libc/elf/rtld.c
    trunk/libc/gmon/gmon.c
    trunk/libc/hurd/hurdsig.c
    trunk/libc/iconv/gconv_conf.c
    trunk/libc/iconv/iconv_charmap.c
    trunk/libc/iconv/iconv_prog.c
    trunk/libc/iconv/iconv_prog.h
    trunk/libc/include/stdio.h
    trunk/libc/inet/inet6_opt.c
    trunk/libc/inet/rcmd.c
    trunk/libc/intl/bindtextdom.c
    trunk/libc/intl/loadmsgcat.c
    trunk/libc/io/tst-fchownat.c
    trunk/libc/libidn/ChangeLog
    trunk/libc/libidn/stringprep.c
    trunk/libc/libio/bits/stdio-ldbl.h
    trunk/libc/libio/bits/stdio2.h
    trunk/libc/libio/genops.c
    trunk/libc/libio/obprintf.c
    trunk/libc/libio/wgenops.c
    trunk/libc/locale/iso-639.def
    trunk/libc/locale/programs/ld-collate.c
    trunk/libc/locale/programs/linereader.c
    trunk/libc/localedata/ChangeLog
    trunk/libc/localedata/SUPPORTED
    trunk/libc/localedata/locales/en_CA
    trunk/libc/localedata/locales/es_CR
    trunk/libc/localedata/locales/fr_CA
    trunk/libc/localedata/locales/ik_CA
    trunk/libc/localedata/locales/iso14651_t1_common
    trunk/libc/localedata/locales/iu_CA
    trunk/libc/localedata/locales/mr_IN
    trunk/libc/localedata/locales/pt_PT
    trunk/libc/malloc/malloc.c
    trunk/libc/math/libm-test.inc
    trunk/libc/misc/sys/queue.h
    trunk/libc/nis/nis_call.c
    trunk/libc/nis/nss_compat/compat-pwd.c
    trunk/libc/nis/nss_compat/compat-spwd.c
    trunk/libc/nis/ypclnt.c
    trunk/libc/nptl/ChangeLog
    trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/dl-sysdep.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
    trunk/libc/nptl_db/ChangeLog
    trunk/libc/nptl_db/structs.def
    trunk/libc/nptl_db/td_ta_thr_iter.c
    trunk/libc/nptl_db/td_thr_validate.c
    trunk/libc/nscd/connections.c
    trunk/libc/nscd/nscd.h
    trunk/libc/nscd/nscd_conf.c
    trunk/libc/nscd/nscd_helper.c
    trunk/libc/nss/nss_files/files-XXX.c
    trunk/libc/po/be.po
    trunk/libc/po/bg.po
    trunk/libc/po/ca.po
    trunk/libc/po/cs.po
    trunk/libc/po/da.po
    trunk/libc/po/de.po
    trunk/libc/po/es.po
    trunk/libc/po/fr.po
    trunk/libc/po/hr.po
    trunk/libc/po/ko.po
    trunk/libc/po/nl.po
    trunk/libc/po/rw.po
    trunk/libc/po/sk.po
    trunk/libc/po/sv.po
    trunk/libc/po/tr.po
    trunk/libc/po/zh_CN.po
    trunk/libc/po/zh_TW.po
    trunk/libc/posix/gai.conf
    trunk/libc/posix/getopt.c
    trunk/libc/resolv/nss_dns/dns-host.c
    trunk/libc/resolv/res_debug.c
    trunk/libc/stdlib/Makefile
    trunk/libc/stdlib/strtod_l.c
    trunk/libc/sunrpc/xdr_sizeof.c
    trunk/libc/sysdeps/generic/ldsodefs.h
    trunk/libc/sysdeps/ia64/ieee754.h
    trunk/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
    trunk/libc/sysdeps/ieee754/dbl-64/s_rint.c
    trunk/libc/sysdeps/ieee754/ieee754.h
    trunk/libc/sysdeps/ieee754/ldbl-opt/Makefile
    trunk/libc/sysdeps/ieee754/ldbl-opt/Versions
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
    trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
    trunk/libc/sysdeps/mach/hurd/i386/trampoline.c
    trunk/libc/sysdeps/mach/hurd/if_index.c
    trunk/libc/sysdeps/posix/getaddrinfo.c
    trunk/libc/sysdeps/posix/sprofil.c
    trunk/libc/sysdeps/s390/fpu/fegetenv.c
    trunk/libc/sysdeps/s390/fpu/fesetenv.c
    trunk/libc/sysdeps/unix/sysv/linux/adjtime.c
    trunk/libc/sysdeps/unix/sysv/linux/bits/posix_opt.h
    trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h
    trunk/libc/sysdeps/unix/sysv/linux/dl-osinfo.h
    trunk/libc/sysdeps/unix/sysv/linux/dl-sysdep.c
    trunk/libc/sysdeps/unix/sysv/linux/dl-sysdep.h
    trunk/libc/sysdeps/unix/sysv/linux/fpathconf.c
    trunk/libc/sysdeps/unix/sysv/linux/pathconf.c
    trunk/libc/sysdeps/unix/sysv/linux/pathconf.h
    trunk/libc/sysdeps/unix/sysv/linux/s390/sys/user.h
    trunk/libc/sysdeps/unix/sysv/linux/sysconf.c
    trunk/libc/sysdeps/x86_64/cacheinfo.c
    trunk/libc/sysdeps/x86_64/memset.S
    trunk/libc/time/lc-time-cleanup.c
    trunk/libc/time/tzset.c
    trunk/ports/ChangeLog.hppa
    trunk/ports/ChangeLog.mips
    trunk/ports/sysdeps/hppa/nptl/Makefile
    trunk/ports/sysdeps/mips/fpu/fesetround.c
    trunk/ports/sysdeps/mips/fpu/fgetexcptflg.c
    trunk/ports/sysdeps/mips/fpu/fsetexcptflg.c
    trunk/ports/sysdeps/mips/ieee754.h
    trunk/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
    trunk/ports/sysdeps/unix/sysv/linux/mips/bits/siginfo.h

Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Thu Mar 27 06:22:15 2008
@@ -1,3 +1,296 @@
+2008-03-25  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* posix/gai.conf: Fix comment for scope nullbits.
+	* sysdeps/posix/getaddrinfo.c (gaiconf_init): If /bits is not present,
+	default to 128 bits for v4 mapped addresses.
+
+2008-03-07  Martin Schwidefsky  <schwidefsky@xxxxxxxxxx>
+
+	* sysdeps/s390/fpu/fegetenv.c (fegetenv): Remove PTRACE_PEEKUSER
+	ptrace call to get the ieee_instruction_pointer from the kernel.
+	* sysdeps/s390/fpu/fesetenv.c (fesetenv): Remove PTRACE_POKEUSER
+	ptrace call to set the ieee_instructtion_pointer.
+	* sysdeps/unix/sysv/linux/s390/sys/user.h (struct _user_regs_struct):
+	Add comment that ieee_instruction_pointer is always 0.
+
+2008-03-09  Andreas Jaeger  <aj@xxxxxxx>
+
+	[BZ #5857]
+	* sysdeps/ieee754/dbl-64/s_rint.c (__rint): Handle j0==18.
+	* sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Likewise.
+  	Patch by Mark Elliott <mark.h.elliott@xxxxxxxx>.
+
+	* math/libm-test.inc (nearbyint_test): Add new test cases from #5857.
+	(rint_test): Likewise.
+
+2008-03-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nis/nis_call.c (nis_server_cache_search): Save errno around stat
+	call.
+	(__nisfind_server): Similar for open readColdStartFile call.
+	Patch partially by Jim Meyering.
+	* nss/nss_files/files-XXX.c (_nss_files_getXXent_r): Save errno
+	around internal_setent call.
+
+	* po/vi.po: New Vietnamese translation.
+
+	* sysdeps/unix/sysv/linux/adjtime.c: Correctly use
+	ADJ_OFFSET_SS_READ.
+
+	* sysdeps/unix/sysv/linux/bits/sched.h: Add new CLONE_* flags,
+	remove CLONE_STOPPED.
+
+2008-02-10  Jim Meyering  <meyering@xxxxxxxxxx>
+
+	Remove useless "if" before "free":
+	* elf/ldconfig.c (parse_conf_include): Likewise.
+	* gmon/gmon.c (weak_alias): Likewise.
+	* iconv/gconv_conf.c (__gconv_get_path): Likewise.
+	* inet/rcmd.c (__validuser2_sa): Likewise.
+	* intl/bindtextdom.c (set_binding_values): Likewise.
+	* intl/loadmsgcat.c (_nl_load_domain, _nl_unload_domain): Likewise.
+	* libio/genops.c (save_for_backup): Likewise.
+	* libio/wgenops.c (save_for_wbackup): Likewise.
+	* locale/programs/ld-collate.c (collate_read): Likewise.
+	* locale/programs/linereader.c (get_string): Likewise.
+	* nis/nss_compat/compat-pwd.c (give_pwd_free): Likewise.
+	* nis/nss_compat/compat-spwd.c (give_spwd_free): Likewise.
+	* resolv/res_debug.c (do_section): Likewise.
+	* sunrpc/xdr_sizeof.c (x_inline, xdr_sizeof): Likewise.
+	* sysdeps/mach/hurd/if_index.c (libc_hidden_def): Likewise.
+	* sysdeps/posix/sprofil.c (__sprofil): Likewise.
+	* time/lc-time-cleanup.c (_nl_cleanup_time): Likewise.
+	* time/tzset.c (tzset_internal): Likewise.
+
+2008-03-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/dl-sysdep.h: Use __ASSEMBLER__ instead
+	of ASSEMBLER.
+
+2008-03-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5903]
+	* iconv/iconv_charmap.c (charmap_conversion): Pass name of output file
+	not stream for output file.  Open output file here.
+	* iconv/iconv_prog.c (process_lock): Take pointer to output stream
+	and output file name.
+	(process_fd): Likewise.
+	(process_file): Likewise.
+	(main): Adjust callers of changed functions.
+	* iconv/iconv_prog.h: Adjust prototype.
+
+2008-03-09  Andreas Jaeger  <aj@xxxxxxx>
+
+	[BZ #5753]
+	* sysdeps/ia64/ieee754.h: Use protected namespace
+	__BIG_ENDIAN/__LITTLE_ENDIAN.
+	* sysdeps/ieee754/ieee754.h: Likewise.
+	Patch by Aurelien Jarno <aurelien@xxxxxxxxxxx>.
+
+2008-03-08  Roland McGrath  <roland@xxxxxxxx>
+
+	* hurd/hurdsig.c (_hurd_internal_post_signal): When normal rules would
+	ignore a signal that came from a machine exception, treat it as a
+	fatal core-dump signal instead.
+	Reported by Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>.
+
+	* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
+	Clear DF bit in thread state's eflags.
+	Reported by Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>.
+
+2008-03-08  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5774]
+	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Consume closing brace
+	of NAN(...) sequence.
+	* stdlib/Makefile (tests): Add tst-strtod6.
+	* stdlib/tst-strtod6.c: New file.
+
+	* inet/inet6_opt.c (inet6_opt_init): Check extlen for overflow.
+
+	[BZ #5762]
+	* posix/getopt.c (_getopt_internal_r): Clarify error message by
+	putting offending option character in quotes.  Clean up error
+	messages.
+	* po/be.po: Adjust msgstr in translation file.
+	* po/bg.po: Likewise.
+	* po/ca.po: Likewise.
+	* po/cs.po: Likewise.
+	* po/da.po: Likewise.
+	* po/de.po: Likewise.
+	* po/es.po: Likewise.
+	* po/fr.po: Likewise.
+	* po/hr.po: Likewise.
+	* po/ko.po: Likewise.
+	* po/nl.po: Likewise.
+	* po/rw.po: Likewise.
+	* po/sk.po: Likewise.
+	* po/sv.po: Likewise.
+	* po/tr.po: Likewise.
+	* po/zh_CN.po: Likewise.
+	* po/zh_TW.po: Likewise.
+
+	[BZ #5760]
+	* inet/inet6_opt.c (inet6_opt_init): Fix ip6h_len computation.
+	Patch by Roland Bless <roland@xxxxxxxx>.
+
+	* sysdeps/unix/sysv/linux/dl-sysdep.c: Avoid unnecessary code for
+	.o file.
+	* elf/Makefile (routines): Add dl-sysdep.
+	(elide-routines.os): Likewise.
+
+2008-03-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5786]
+	* elf/dl-sysdep.c: Undefine ROUND after use.
+	* sysdeps/generic/ldsodefs.h [HAVE_DL_DISCOVER_OSVERSION]
+	(struct rtld_global_ro): Add _dl_tls_get_addr_soft element.
+	* elf/rtld.c (rtld_global_ro): Initialize _dl_discover_osversion.
+	* sysdeps/unix/sysv/linux/dl-osinfo.h: Move _dl_discover_osversion
+	to ...
+	* sysdeps/unix/sysv/linux/dl-sysdep.c: ...here.
+	* sysdeps/unix/sysv/linux/dl-sysdep.h: Declare _dl_discover_osversion
+	if necessary.
+	* sysdeps/unix/sysv/linux/sysconf.c: Handle _SC_ARG_MAX here.
+
+	* sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Add
+	_dl_tls_get_addr_soft element.
+	* elf/rtld.c (rtld_global_ro): Initialize _dl_tls_get_addr_soft.
+	* elf/Versions (ld): Don't export _dl_tls_get_addr_soft.
+	* dlfcn/dlinfo.c (dlinfo_doit): Access dl_tls_get_addr_soft through
+	GLRO.
+	* elf/dl-iteratephdr.c (__dl_iterate_phdr): Likewise.
+	* elf/dl-tls.c (_dl_tls_get_addr_soft): Use attribute_hidden instead
+	of internal_function.
+
+	* stdlib/Makefile (aux): Add tens_in_limb.
+	* stdlib/strtod_l.c: Move _tens_in_limb definition to...
+	* stdlib/tens_in_limb.c: ...here.  New file.
+
+	[BZ #5778]
+	* sysdeps/unix/sysv/linux/pathconf.h: Declare
+	__statfs_chown_restricted.
+	* sysdeps/unix/sysv/linux/fpathconf.c: Call __statfs_chown_restricted
+	for _PC_CHOWN_RESTRICTED.
+	* sysdeps/unix/sysv/linux/pathconf.c: Likewise.
+	Implement __statfs_chown_restricted.
+	* sysdeps/unix/sysv/linux/bits/posix_opt.h: Change
+	_POSIX_CHOWN_RESTRICTED value to zero.
+	* io/tst-fchownat.c: Correctly handle _POSIX_CHOWN_RESTRICTED
+	defined to zero.
+
+	* sysdeps/x86_64/rtld-memset.c: New file.
+
+2008-02-26  Harsha Jagasia  <harsha.jagasia@xxxxxxx>
+
+	* sysdeps/x86_64/cacheinfo.c (NOT_USED_RIGHT_NOW): Remove ifdef guards.
+
+	* sysdeps/x86_64/memset.S: Rewrite non-SSE code path as tuned for AMD
+	Barcelona machine.  Make default fall through branch of
+	__x86_64_preferred_memory_instruction check as the integer code path.
+
+2007-10-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/cacheinfo.c
+	(__x86_64_preferred_memory_instruction): New variable.
+	(init_cacheinfo): Initialize __x86_64_preferred_memory_instruction.
+
+	* sysdeps/x86_64/memset.S: Rewrite.
+
+2008-03-04  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* include/stdio.h (__asprintf_chk, __dprintf_chk,
+	__obstack_printf_chk): New prototypes.
+	(__vasprintf_chk, __vdprintf_chk,
+	__obstack_vprintf_chk): Likewise.
+	Add libc_hidden_proto.
+	* libio/obprintf.c
+	(_IO_obstack_jumps): No longer static, add attribute_hidden.
+	* libio/bits/stdio-ldbl.h (__asprintf_chk, __dprintf_chk,
+	__obstack_printf_chk, __vasprintf_chk, __vdprintf_chk,
+	__obstack_vprintf_chk): Add __LDBL_REDIR_DECL.
+	* libio/bits/stdio2.h (__asprintf_chk, __dprintf_chk,
+	__obstack_printf_chk, __vasprintf_chk, __vdprintf_chk,
+	__obstack_vprintf_chk): New prototypes.
+	(asprintf, __asprintf, dprintf, obstack_printf, vasprintf, vdprintf,
+	obstack_vprintf): New inlines.
+	* debug/dprintf_chk.c: New file.
+	* debug/vdprintf_chk.c: New file.
+	* debug/asprintf_chk.c: New file.
+	* debug/vasprintf_chk.c: New file.
+	* debug/obprintf_chk.c: New file.
+	* debug/tst-chk1.c (do_test): Add asprintf and obstack_printf tests.
+	* debug/Versions (__asprintf_chk, __dprintf_chk, __obstack_printf_chk,
+	__vasprintf_chk, __vdprintf_chk, __obstack_vprintf_chk): Export
+	@@GLIBC_2.8.
+	* debug/Makefile: Build asprintf_chk, vasprintf_chk, dprintf_chk,
+	vdprintf_chk and obprintf_chk, set CFLAGS for them.
+	* sysdeps/ieee754/ldbl-opt/nldbl-compat.c (__nldbl___vasprintf_chk,
+	__nldbl___vdprintf_chk, __nldbl___obstack_vprintf_chk): Add
+	libc_hidden_proto.
+	* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl___vasprintf_chk,
+	__nldbl___vdprintf_chk, __nldbl___obstack_vprintf_chk): New prototypes.
+	* sysdeps/ieee754/ldbl-opt/Versions (__nldbl___asprintf_chk,
+	__nldbl___vasprintf_chk, __nldbl___dprintf_chk, __nldbl___vdprintf_chk,
+	__nldbl___obstack_printf_chk, __nldbl___obstack_vprintf_chk): Export
+	@@GLIBC_2.8.
+	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add asprintf_chk,
+	vasprintf_chk, dprintf_chk, vdprintf_chk, obstack_printf_chk and
+	obstack_vprintf_chk.
+	* sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf_chk.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-dprintf_chk.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf_chk.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-asprintf_chk.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-vdprintf_chk.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-vasprintf_chk.c: New file.
+
+2008-03-04  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5779]
+	* misc/sys/queue.h: Add STAILQ_CONCAT and TAILQ_CONCAT definitions.
+	Patch by Roy Marples <roy@xxxxxxxxxxxx>.
+
+	[BZ #5736]
+	* malloc/malloc.c: Fix typo in comment.
+
+	[BZ #5627]
+	* locale/iso-639.def: Add Shuswap.
+
+2008-02-25  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #5790]
+	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr2_r): Don't
+	overwrite *h_errnop/*errnop values from getanswer_r in case of
+	failure.
+
+2008-03-03  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5818]
+	* nscd/connections.c (dbs): Add initializers for .suggested_module.
+	(verify_persistent_db): Remove one unnecessary test and add a new one
+	for bad configuration.
+	(nscd_init): Improve error reported when persistent database cannot
+	be reused.
+	* nscd/nscd.h (DEFAULT_SUGGESTED_MODULE): Define.
+	* nscd/nscd_conf.c (nscd_parse_file): Provide default values for
+	.suggested_module and .max_db_size and case config file says the
+	values are zero.
+	* nscd/nscd_helper.c (get_mapping): Fail if hash table module is zero.
+
+	[BZ #5854]
+	* nis/ypclnt.c (yp_order): Fix handling of return value of
+	do_ypcall_tr call.
+	Patch by Jeff Moyer <jmoyer@xxxxxxxxxx>.
+
+	* po/fr.po: Update from translation team.
+
+2008-02-22  Andreas Jaeger  <aj@xxxxxxx>,
+	    Carlos O'Donell <carlos@xxxxxxxxxxxxxxxx>
+
+	[BZ #5012]
+	* FAQ.in: Describe why glibc needs to be compiled with
+	optimization.
+
 2008-02-19  Roland McGrath  <roland@xxxxxxxxxx>
 
 	* elf/elf.h (SHT_GNU_ATTRIBUTES): New macro.
@@ -215,7 +508,7 @@
 	* stdlib/Makefile: Add rules to build and run tst-makecontext2.
 	* stdlib/tst-makecontext2.c: New test.
 
-008-01-08  Jakub Jelinek  <jakub@xxxxxxxxxx>
+2008-01-08  Jakub Jelinek  <jakub@xxxxxxxxxx>
 
 	* iconv/loop.c (UPDATE_PARAMS): Define to empty statement if not
 	defined.
@@ -298,7 +591,7 @@
 
 2007-12-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
-	* malloc/malloc.c (public_cALLOc): For arena other than
+	* malloc/malloc.c (public_cALLOc): For arenas other than
 	main_arena, count all bytes inside the mprotect_size range of the
 	heap as uninitialized.
 

Modified: trunk/libc/FAQ
==============================================================================
--- trunk/libc/FAQ (original)
+++ trunk/libc/FAQ Thu Mar 27 06:22:15 2008
@@ -50,6 +50,9 @@
 1.21.	Which compiler should I use for powerpc64?
 1.22.	`make' fails when running rpcgen the first time,
 	what is going on? How do I fix this?
+1.23.	Why do I get:
+	`#error "glibc cannot be compiled without optimization"',
+	when trying to compile GNU libc with GNU CC?
 
 2. Installation and configuration issues
 
@@ -484,12 +487,12 @@
 failure should be looked into.  Depending on the failures, you probably
 should not install the library at all.
 
-You should consider using the `glibcbug' script to report the failure,
-providing as much detail as possible.  If you run a test directly, please
-remember to set up the environment correctly.  You want to test the compiled
-library - and not your installed one.  The best way is to copy the exact
-command line which failed and run the test from the subdirectory for this
-test in the sources.
+You should consider reporting it in bugzilla
+<http://sourceware.org/bugzilla/> providing as much detail as possible.
+If you run a test directly, please remember to set up the environment
+correctly. You want to test the compiled library - and not your installed
+one. The best way is to copy the exact command line which failed and run
+the test from the subdirectory for this test in the sources.
 
 There are some failures which are not directly related to the GNU libc:
 - Some compilers produce buggy code.  No compiler gets single precision
@@ -588,6 +591,32 @@
 yourself. Please remember that for each architecture there may be various
 patches required to get glibc HEAD into a runnable state. The best course
 of action is to determine if you have all the required patches.
+
+
+1.23.	Why do I get:
+	`#error "glibc cannot be compiled without optimization"',
+	when trying to compile GNU libc with GNU CC?
+
+{AJ,CO} There are a couple of reasons why the GNU C library will not work
+correctly if it is not complied with optimzation.
+
+In the early startup of the dynamic loader (_dl_start), before
+relocation of the PLT, you cannot make function calls. You must inline
+the functions you will use during early startup, or call compiler
+builtins (__builtin_*).
+
+Without optimizations enabled GNU CC will not inline functions. The
+early startup of the dynamic loader will make function calls via an
+unrelocated PLT and crash. 
+
+Without auditing the dynamic linker code it would be difficult to remove
+this requirement. 
+
+Another reason is that nested functions must be inlined in many cases to
+avoid executable stacks.
+
+In practice there is no reason to compile without optimizations, therefore
+we require that GNU libc be compiled with optimizations enabled.
 
 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
@@ -1957,6 +1986,7 @@
 {AO} Alexandre Oliva, <aoliva@xxxxxxxxxx>
 {BH} Bruno Haible, <haible@xxxxxxxxxxxxxx>
 {SM} Steven Munroe, <sjmunroe@xxxxxxxxxx>
+{CO} Carlos O'Donell, <carlos@xxxxxxxxxxxxxxxx>
 
 Local Variables:
  mode:outline

Modified: trunk/libc/FAQ.in
==============================================================================
--- trunk/libc/FAQ.in (original)
+++ trunk/libc/FAQ.in Thu Mar 27 06:22:15 2008
@@ -386,6 +386,31 @@
 yourself. Please remember that for each architecture there may be various
 patches required to get glibc HEAD into a runnable state. The best course
 of action is to determine if you have all the required patches.
+
+??	Why do I get:
+	`#error "glibc cannot be compiled without optimization"',
+	when trying to compile GNU libc with GNU CC?
+
+{AJ,CO} There are a couple of reasons why the GNU C library will not work
+correctly if it is not complied with optimzation.
+
+In the early startup of the dynamic loader (_dl_start), before
+relocation of the PLT, you cannot make function calls. You must inline
+the functions you will use during early startup, or call compiler
+builtins (__builtin_*).
+
+Without optimizations enabled GNU CC will not inline functions. The
+early startup of the dynamic loader will make function calls via an
+unrelocated PLT and crash. 
+
+Without auditing the dynamic linker code it would be difficult to remove
+this requirement. 
+
+Another reason is that nested functions must be inlined in many cases to
+avoid executable stacks.
+
+In practice there is no reason to compile without optimizations, therefore
+we require that GNU libc be compiled with optimizations enabled.
 
 ? Installation and configuration issues
 
@@ -1685,6 +1710,7 @@
 {AO} Alexandre Oliva, <aoliva@xxxxxxxxxx>
 {BH} Bruno Haible, <haible@xxxxxxxxxxxxxx>
 {SM} Steven Munroe, <sjmunroe@xxxxxxxxxx>
+{CO} Carlos O'Donell, <carlos@xxxxxxxxxxxxxxxx>
 
 Local Variables:
  mode:outline

Modified: trunk/libc/debug/Makefile
==============================================================================
--- trunk/libc/debug/Makefile (original)
+++ trunk/libc/debug/Makefile Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2001,2004,2005,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1998-2001,2004-2008 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
@@ -37,6 +37,8 @@
 	    realpath_chk ptsname_r_chk fread_chk fread_u_chk \
 	    confstr_chk getgroups_chk ttyname_r_chk \
 	    gethostname_chk getdomainname_chk \
+	    asprintf_chk vasprintf_chk dprintf_chk \
+	    vdprintf_chk obprintf_chk \
 	    stack_chk_fail fortify_fail \
 	    $(static-only-routines)
 routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin_r_chk
@@ -60,6 +62,11 @@
 CFLAGS-snprintf_chk.c = -D_IO_MTSAFE_IO
 CFLAGS-vsprintf_chk.c = -D_IO_MTSAFE_IO
 CFLAGS-vsnprintf_chk.c = -D_IO_MTSAFE_IO
+CFLAGS-asprintf_chk.c = -D_IO_MTSAFE_IO
+CFLAGS-vasprintf_chk.c = -D_IO_MTSAFE_IO
+CFLAGS-obprintf_chk.c = -D_IO_MTSAFE_IO
+CFLAGS-dprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-vdprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 CFLAGS-printf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 CFLAGS-fprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 CFLAGS-vprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)

Modified: trunk/libc/debug/Versions
==============================================================================
--- trunk/libc/debug/Versions (original)
+++ trunk/libc/debug/Versions Thu Mar 27 06:22:15 2008
@@ -42,6 +42,10 @@
   GLIBC_2.7 {
     __fread_chk; __fread_unlocked_chk;
   }
+  GLIBC_2.8 {
+    __asprintf_chk; __vasprintf_chk;  __dprintf_chk; __vdprintf_chk;
+    __obstack_printf_chk; __obstack_vprintf_chk;
+  }
   GLIBC_PRIVATE {
     __fortify_fail;
   }

Modified: trunk/libc/debug/tst-chk1.c
==============================================================================
--- trunk/libc/debug/tst-chk1.c (original)
+++ trunk/libc/debug/tst-chk1.c Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2004.
 
@@ -20,6 +20,7 @@
 #include <assert.h>
 #include <fcntl.h>
 #include <locale.h>
+#include <obstack.h>
 #include <paths.h>
 #include <setjmp.h>
 #include <signal.h>
@@ -31,6 +32,9 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <gnu/option-groups.h>
+
+#define obstack_chunk_alloc malloc
+#define obstack_chunk_free free
 
 char *temp_filename;
 static void do_prepare (void);
@@ -710,6 +714,36 @@
   if (fprintf (fp, buf2 + 4, str5) != 7)
     FAIL ();
 
+  char *my_ptr = NULL;
+  strcpy (buf2 + 2, "%n%s%n");
+  /* When the format string is writable and contains %n,
+     with -D_FORTIFY_SOURCE=2 it causes __chk_fail.  */
+  CHK_FAIL2_START
+  if (asprintf (&my_ptr, buf2, str4, &n1, str5, &n1) != 14)
+    FAIL ();
+  else
+    free (my_ptr);
+  CHK_FAIL2_END
+
+  struct obstack obs;
+  obstack_init (&obs);
+  CHK_FAIL2_START
+  if (obstack_printf (&obs, buf2, str4, &n1, str5, &n1) != 14)
+    FAIL ();
+  CHK_FAIL2_END
+  obstack_free (&obs, NULL);
+
+  my_ptr = NULL;
+  if (asprintf (&my_ptr, "%s%n%s%n", str4, &n1, str5, &n1) != 14)
+    FAIL ();
+  else
+    free (my_ptr);
+
+  obstack_init (&obs);
+  if (obstack_printf (&obs, "%s%n%s%n", str4, &n1, str5, &n1) != 14)
+    FAIL ();
+  obstack_free (&obs, NULL);
+
   if (freopen (temp_filename, "r", stdin) == NULL)
     {
       puts ("could not open temporary file");

Modified: trunk/libc/dlfcn/dlinfo.c
==============================================================================
--- trunk/libc/dlfcn/dlinfo.c (original)
+++ trunk/libc/dlfcn/dlinfo.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* dlinfo -- Get information from the dynamic linker.
-   Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006, 2007, 2008 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
@@ -101,7 +101,7 @@
       {
 	void *data = NULL;
 	if (l->l_tls_modid != 0)
-	  data = _dl_tls_get_addr_soft (l);
+	  data = GLRO(dl_tls_get_addr_soft) (l);
 	*(void **) args->arg = data;
 	break;
       }

Modified: trunk/libc/elf/Makefile
==============================================================================
--- trunk/libc/elf/Makefile (original)
+++ trunk/libc/elf/Makefile Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1995-2007, 2008 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
@@ -23,7 +23,7 @@
 headers		= elf.h bits/elfclass.h link.h bits/link.h
 routines	= $(dl-routines) dl-support dl-iteratephdr \
 		  dl-addr enbl-secure dl-profstub \
-		  dl-origin dl-libc dl-sym dl-tsd
+		  dl-origin dl-libc dl-sym dl-tsd dl-sysdep
 
 # The core dynamic linking functions are in libc for the static and
 # profiled libraries.
@@ -33,7 +33,8 @@
 				  execstack caller open close trampoline)
 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
 # But they are absent from the shared libc, because that code is in ld.so.
-elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin
+elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
+		    dl-sysdep
 shared-only-routines += dl-caller
 
 # ld.so uses those routines, plus some special stuff for being the program

Modified: trunk/libc/elf/Versions
==============================================================================
--- trunk/libc/elf/Versions (original)
+++ trunk/libc/elf/Versions Thu Mar 27 06:22:15 2008
@@ -57,7 +57,6 @@
     _dl_allocate_tls; _dl_deallocate_tls;
     _dl_get_tls_static_info; _dl_allocate_tls_init;
     _dl_tls_setup; _dl_rtld_di_serinfo;
-    _dl_tls_get_addr_soft;
     _dl_make_stack_executable;
     # Only here for gdb while a better method is developed.
     _dl_debug_state;

Modified: trunk/libc/elf/dl-iteratephdr.c
==============================================================================
--- trunk/libc/elf/dl-iteratephdr.c (original)
+++ trunk/libc/elf/dl-iteratephdr.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Get loaded objects program headers.
-   Copyright (C) 2001,2002,2003,2004,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004,2006,2007,2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2001.
 
@@ -72,7 +72,7 @@
       info.dlpi_tls_data = NULL;
       info.dlpi_tls_modid = l->l_tls_modid;
       if (info.dlpi_tls_modid != 0)
-	info.dlpi_tls_data = _dl_tls_get_addr_soft (l);
+	info.dlpi_tls_data = GLRO(dl_tls_get_addr_soft) (l);
       ret = callback (&info, sizeof (struct dl_phdr_info), data);
       if (ret)
 	break;

Modified: trunk/libc/elf/dl-sysdep.c
==============================================================================
--- trunk/libc/elf/dl-sysdep.c (original)
+++ trunk/libc/elf/dl-sysdep.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Generic Unix version.
-   Copyright (C) 1995-1998, 2000-2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2007, 2008 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
@@ -398,6 +398,7 @@
 		  }
 		note = ((const void *) (note + 1)
 			+ ROUND (note->vendorlen) + ROUND (note->datalen));
+#undef ROUND
 	      }
 	    if (dsocaps != NULL)
 	      break;

Modified: trunk/libc/elf/dl-tls.c
==============================================================================
--- trunk/libc/elf/dl-tls.c (original)
+++ trunk/libc/elf/dl-tls.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  Generic version.
-   Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+   Copyright (C) 2002,2003,2004,2005,2006,2008 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
@@ -758,7 +758,6 @@
 /* Look up the module's TLS block as for __tls_get_addr,
    but never touch anything.  Return null if it's not allocated yet.  */
 void *
-internal_function
 _dl_tls_get_addr_soft (struct link_map *l)
 {
   if (__builtin_expect (l->l_tls_modid == 0, 0))

Modified: trunk/libc/elf/ldconfig.c
==============================================================================
--- trunk/libc/elf/ldconfig.c (original)
+++ trunk/libc/elf/ldconfig.c Thu Mar 27 06:22:15 2008
@@ -1184,8 +1184,7 @@
       break;
     }
 
-  if (copy)
-    free (copy);
+  free (copy);
 }
 
 /* Honour LD_HWCAP_MASK.  */

Modified: trunk/libc/elf/rtld.c
==============================================================================
--- trunk/libc/elf/rtld.c (original)
+++ trunk/libc/elf/rtld.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Run time dynamic linker.
-   Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007, 2008 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
@@ -161,7 +161,11 @@
     ._dl_lookup_symbol_x = _dl_lookup_symbol_x,
     ._dl_check_caller = _dl_check_caller,
     ._dl_open = _dl_open,
-    ._dl_close = _dl_close
+    ._dl_close = _dl_close,
+    ._dl_tls_get_addr_soft = _dl_tls_get_addr_soft,
+#ifdef HAVE_DL_DISCOVER_OSVERSION
+    ._dl_discover_osversion = _dl_discover_osversion
+#endif
   };
 /* If we would use strong_alias here the compiler would see a
    non-hidden definition.  This would undo the effect of the previous

Modified: trunk/libc/gmon/gmon.c
==============================================================================
--- trunk/libc/gmon/gmon.c (original)
+++ trunk/libc/gmon/gmon.c Thu Mar 27 06:22:15 2008
@@ -396,6 +396,5 @@
     write_gmon ();
 
   /* free the memory. */
-  if (_gmonparam.tos != NULL)
-    free (_gmonparam.tos);
-}
+  free (_gmonparam.tos);
+}

Modified: trunk/libc/hurd/hurdsig.c
==============================================================================
--- trunk/libc/hurd/hurdsig.c (original)
+++ trunk/libc/hurd/hurdsig.c Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2005
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,2001,2002,2005,2008
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -743,6 +743,11 @@
       break;
 
     case ignore:
+      if (detail->exc)
+	/* Blocking or ignoring a machine exception is fatal.
+	   Otherwise we could just spin on the faulting instruction.  */
+	goto fatal;
+
       /* Nobody cares about this signal.  If there was a call to resume
 	 above in SIGCONT processing and we've left a thread suspended,
 	 now's the time to set it going. */
@@ -759,6 +764,8 @@
 	 Nothing to do but die; BSD gets SIGILL in this case.  */
       detail->code = signo;	/* XXX ? */
       signo = SIGILL;
+
+    fatal:
       act = core;
       /* FALLTHROUGH */
 

Modified: trunk/libc/iconv/gconv_conf.c
==============================================================================
--- trunk/libc/iconv/gconv_conf.c (original)
+++ trunk/libc/iconv/gconv_conf.c Thu Mar 27 06:22:15 2008
@@ -529,8 +529,7 @@
 
       __gconv_path_elem = result ?: (struct path_elem *) &empty_path_elem;
 
-      if (cwd != NULL)
-	free (cwd);
+      free (cwd);
     }
 
   __libc_lock_unlock (lock);

Modified: trunk/libc/iconv/iconv_charmap.c
==============================================================================
--- trunk/libc/iconv/iconv_charmap.c (original)
+++ trunk/libc/iconv/iconv_charmap.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Convert using charmaps and possibly iconv().
-   Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005, 2006, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2001.
 
@@ -94,7 +94,8 @@
 int
 charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
 		    const char *to_code, struct charmap_t *to_charmap,
-		    int argc, int remaining, char *argv[], FILE *output)
+		    int argc, int remaining, char *argv[],
+		    const char *output_file)
 {
   struct convtable *cvtbl;
   int status = EXIT_SUCCESS;
@@ -131,6 +132,17 @@
   /* If we couldn't generate a table stop now.  */
   if (cvtbl == NULL)
     return EXIT_FAILURE;
+
+  /* Determine output file.  */
+  FILE *output;
+  if (output_file != NULL && strcmp (output_file, "-") != 0)
+    {
+      output = fopen (output_file, "w");
+      if (output == NULL)
+	error (EXIT_FAILURE, errno, _("cannot open output file"));
+    }
+  else
+    output = stdout;
 
   /* We can now start the conversion.  */
   if (remaining == argc)

Modified: trunk/libc/iconv/iconv_prog.c
==============================================================================
--- trunk/libc/iconv/iconv_prog.c (original)
+++ trunk/libc/iconv/iconv_prog.c Thu Mar 27 06:22:15 2008
@@ -109,9 +109,12 @@
 int omit_invalid;
 
 /* Prototypes for the functions doing the actual work.  */
-static int process_block (iconv_t cd, char *addr, size_t len, FILE *output);
-static int process_fd (iconv_t cd, int fd, FILE *output);
-static int process_file (iconv_t cd, FILE *input, FILE *output);
+static int process_block (iconv_t cd, char *addr, size_t len, FILE **output,
+			  const char *output_file);
+static int process_fd (iconv_t cd, int fd, FILE **output,
+		       const char *output_file);
+static int process_file (iconv_t cd, FILE *input, FILE **output,
+			 const char *output_file);
 static void print_known_names (void) internal_function;
 
 
@@ -120,7 +123,6 @@
 {
   int status = EXIT_SUCCESS;
   int remaining;
-  FILE *output;
   iconv_t cd;
   const char *orig_to_code;
   struct charmap_t *from_charmap = NULL;
@@ -193,16 +195,6 @@
     to_charmap = charmap_read (orig_to_code, /*0, 1,*/1, 0, 0, 0);
 
 
-  /* Determine output file.  */
-  if (output_file != NULL && strcmp (output_file, "-") != 0)
-    {
-      output = fopen (output_file, "w");
-      if (output == NULL)
-	error (EXIT_FAILURE, errno, _("cannot open output file"));
-    }
-  else
-    output = stdout;
-
   /* At this point we have to handle two cases.  The first one is
      where a charmap is used for the from- or to-charset, or both.  We
      handle this special since it is very different from the sane way of
@@ -211,7 +203,7 @@
   if (from_charmap != NULL || to_charmap != NULL)
     /* Construct the conversion table and do the conversion.  */
     status = charmap_conversion (from_code, from_charmap, to_code, to_charmap,
-				 argc, remaining, argv, output);
+				 argc, remaining, argv, output_file);
   else
     {
       /* Let's see whether we have these coded character sets.  */
@@ -276,12 +268,16 @@
 		   _("failed to start conversion processing"));
 	}
 
+      /* The output file.  Will be opened when we are ready to produce
+	 output.  */
+      FILE *output = NULL;
+
       /* Now process the remaining files.  Write them to stdout or the file
 	 specified with the `-o' parameter.  If we have no file given as
 	 the parameter process all from stdin.  */
       if (remaining == argc)
 	{
-	  if (process_file (cd, stdin, output) != 0)
+	  if (process_file (cd, stdin, &output, output_file) != 0)
 	    status = EXIT_FAILURE;
 	}
       else
@@ -324,7 +320,8 @@
 			 _("error while closing input `%s'"),
 			 argv[remaining]);
 
-		ret = process_block (cd, addr, st.st_size, output);
+		ret = process_block (cd, addr, st.st_size, &output,
+				     output_file);
 
 		/* We don't need the input data anymore.  */
 		munmap ((void *) addr, st.st_size);
@@ -344,7 +341,7 @@
 #endif	/* _POSIX_MAPPED_FILES */
 	      {
 		/* Read the file in pieces.  */
-		ret = process_fd (cd, fd, output);
+		ret = process_fd (cd, fd, &output, output_file);
 
 		/* Now close the file.  */
 		close (fd);
@@ -363,11 +360,11 @@
 	      }
 	  }
 	while (++remaining < argc);
-    }
-
-  /* Close the output file now.  */
-  if (fclose (output))
-    error (EXIT_FAILURE, errno, _("error while closing output file"));
+
+      /* Close the output file now.  */
+      if (output != NULL && fclose (output))
+	error (EXIT_FAILURE, errno, _("error while closing output file"));
+    }
 
   return status;
 }
@@ -441,7 +438,43 @@
 
 
 static int
-process_block (iconv_t cd, char *addr, size_t len, FILE *output)
+write_output (const char *outbuf, const char *outptr, FILE **output,
+	      const char *output_file)
+{
+  /* We have something to write out.  */
+  int errno_save = errno;
+
+  if (*output == NULL)
+    {
+      /* Determine output file.  */
+      if (output_file != NULL && strcmp (output_file, "-") != 0)
+	{
+	  *output = fopen (output_file, "w");
+	  if (output == NULL)
+	    error (EXIT_FAILURE, errno, _("cannot open output file"));
+	}
+      else
+	*output = stdout;
+    }
+
+  if (fwrite (outbuf, 1, outptr - outbuf, *output) < (size_t) (outptr - outbuf)
+      || ferror (*output))
+    {
+      /* Error occurred while printing the result.  */
+      error (0, 0, _("\
+conversion stopped due to problem in writing the output"));
+      return -1;
+    }
+
+  errno = errno_save;
+
+  return 0;
+}
+
+
+static int
+process_block (iconv_t cd, char *addr, size_t len, FILE **output,
+	       const char *output_file)
 {
 #define OUTBUF_SIZE	32768
   const char *start = addr;
@@ -468,20 +501,9 @@
 
       if (outptr != outbuf)
 	{
-	  /* We have something to write out.  */
-	  int errno_save = errno;
-
-	  if (fwrite (outbuf, 1, outptr - outbuf, output)
-	      < (size_t) (outptr - outbuf)
-	      || ferror (output))
-	    {
-	      /* Error occurred while printing the result.  */
-	      error (0, 0, _("\
-conversion stopped due to problem in writing the output"));
-	      return -1;
-	    }
-
-	  errno = errno_save;
+	  ret = write_output (outbuf, outptr, output, output_file);
+	  if (ret != 0)
+	    break;
 	}
 
       if (n != (size_t) -1)
@@ -494,20 +516,9 @@
 
 	  if (outptr != outbuf)
 	    {
-	      /* We have something to write out.  */
-	      int errno_save = errno;
-
-	      if (fwrite (outbuf, 1, outptr - outbuf, output)
-		  < (size_t) (outptr - outbuf)
-		  || ferror (output))
-		{
-		  /* Error occurred while printing the result.  */
-		  error (0, 0, _("\
-conversion stopped due to problem in writing the output"));
-		  return -1;
-		}
-
-	      errno = errno_save;
+	      ret = write_output (outbuf, outptr, output, output_file);
+	      if (ret != 0)
+		break;
 	    }
 
 	  if (n != (size_t) -1)
@@ -551,7 +562,7 @@
 
 
 static int
-process_fd (iconv_t cd, int fd, FILE *output)
+process_fd (iconv_t cd, int fd, FILE **output, const char *output_file)
 {
   /* we have a problem with reading from a desriptor since we must not
      provide the iconv() function an incomplete character or shift
@@ -625,16 +636,16 @@
       }
 
   /* Now we have all the input in the buffer.  Process it in one run.  */
-  return process_block (cd, inbuf, actlen, output);
+  return process_block (cd, inbuf, actlen, output, output_file);
 }
 
 
 static int
-process_file (iconv_t cd, FILE *input, FILE *output)
+process_file (iconv_t cd, FILE *input, FILE **output, const char *output_file)
 {
   /* This should be safe since we use this function only for `stdin' and
      we haven't read anything so far.  */
-  return process_fd (cd, fileno (input), output);
+  return process_fd (cd, fileno (input), output, output_file);
 }
 
 

Modified: trunk/libc/iconv/iconv_prog.h
==============================================================================
--- trunk/libc/iconv/iconv_prog.h (original)
+++ trunk/libc/iconv/iconv_prog.h Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2001.
 
@@ -36,7 +36,7 @@
 			       const char *to_code,
 			       struct charmap_t *to_charmap,
 			       int argc, int remaining, char *argv[],
-			       FILE *output);
+			       const char *output_file);
 
 
 #endif	/* iconv_prog.h */

Modified: trunk/libc/include/stdio.h
==============================================================================
--- trunk/libc/include/stdio.h (original)
+++ trunk/libc/include/stdio.h Thu Mar 27 06:22:15 2008
@@ -41,6 +41,14 @@
 extern int __vfprintf_chk (FILE *, int, const char *, _G_va_list);
 extern char *__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp);
 extern char *__fgets_chk (char *buf, size_t size, int n, FILE *fp);
+extern int __asprintf_chk (char **, int, const char *, ...) __THROW;
+extern int __vasprintf_chk (char **, int, const char *, _G_va_list) __THROW;
+extern int __dprintf_chk (int, int, const char *, ...);
+extern int __vdprintf_chk (int, int, const char *, _G_va_list);
+extern int __obstack_printf_chk (struct obstack *, int, const char *, ...)
+     __THROW;
+extern int __obstack_vprintf_chk (struct obstack *, int, const char *,
+				  _G_va_list) __THROW;
 #endif
 
 extern int __isoc99_fscanf (FILE *__restrict __stream,
@@ -149,6 +157,9 @@
 libc_hidden_proto (__vsprintf_chk)
 libc_hidden_proto (__vsnprintf_chk)
 libc_hidden_proto (__vfprintf_chk)
+libc_hidden_proto (__vasprintf_chk)
+libc_hidden_proto (__vdprintf_chk)
+libc_hidden_proto (__obstack_vprintf_chk)
 
 #  if !defined NOT_IN_libc && defined SHARED && defined DO_VERSIONING \
   && !defined NO_HIDDEN

Modified: trunk/libc/inet/inet6_opt.c
==============================================================================
--- trunk/libc/inet/inet6_opt.c (original)
+++ trunk/libc/inet/inet6_opt.c Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2006.
 
@@ -34,12 +34,16 @@
 {
   if (extbuf != NULL)
     {
-      if (extlen <= 0 || (extlen % 8) != 0)
+      if (extlen <= 0 || (extlen % 8) != 0 || extlen > 256 * 8)
 	return -1;
 
       /* Fill in the length in units of 8 octets.  */
       struct ip6_hbh *extp = (struct ip6_hbh *) extbuf;
-      extp->ip6h_len = extlen / 8;
+
+      /* RFC 2460 requires that the header extension length is the
+	 length of the option header in 8-byte units, not including
+	 the first 8 bytes.  Hence we have to subtract one.  */
+      extp->ip6h_len = extlen / 8 - 1;
     }
 
   return sizeof (struct ip6_hbh);

Modified: trunk/libc/inet/rcmd.c
==============================================================================
--- trunk/libc/inet/rcmd.c (original)
+++ trunk/libc/inet/rcmd.c Thu Mar 27 06:22:15 2008
@@ -826,8 +826,7 @@
 	}
     }
 
-    if (buf != NULL)
-      free (buf);
+    free (buf);
 
     return retval;
 }

Modified: trunk/libc/intl/bindtextdom.c
==============================================================================
--- trunk/libc/intl/bindtextdom.c (original)
+++ trunk/libc/intl/bindtextdom.c Thu Mar 27 06:22:15 2008
@@ -203,8 +203,7 @@
 
 		  if (__builtin_expect (result != NULL, 1))
 		    {
-		      if (binding->codeset != NULL)
-			free (binding->codeset);
+		      free (binding->codeset);
 
 		      binding->codeset = result;
 		      modified = 1;

Modified: trunk/libc/intl/loadmsgcat.c
==============================================================================
--- trunk/libc/intl/loadmsgcat.c (original)
+++ trunk/libc/intl/loadmsgcat.c Thu Mar 27 06:22:15 2008
@@ -1236,8 +1236,7 @@
       /* This is an invalid revision.  */
     invalid:
       /* This is an invalid .mo file.  */
-      if (domain->malloced)
-	free (domain->malloced);
+      free (domain->malloced);
 #ifdef HAVE_MMAP
       if (use_mmap)
 	munmap ((caddr_t) data, size);
@@ -1289,12 +1288,10 @@
       if (convd->conv != (__gconv_t) -1)
 	__gconv_close (convd->conv);
     }
-  if (domain->conversions != NULL)
-    free (domain->conversions);
+  free (domain->conversions);
   __libc_rwlock_fini (domain->conversions_lock);
 
-  if (domain->malloced)
-    free (domain->malloced);
+  free (domain->malloced);
 
 # ifdef _POSIX_MAPPED_FILES
   if (domain->use_mmap)

Modified: trunk/libc/io/tst-fchownat.c
==============================================================================
--- trunk/libc/io/tst-fchownat.c (original)
+++ trunk/libc/io/tst-fchownat.c Thu Mar 27 06:22:15 2008
@@ -19,14 +19,17 @@
 static void
 prepare (void)
 {
-#if _POSIX_CHOWN_RESTRICTED > 0
-  uid_t uid = getuid ();
-  if (uid != 0)
+#if _POSIX_CHOWN_RESTRICTED == 0
+  if (pathconf (test_dir, _PC_CHOWN_RESTRICTED) != 0)
+#endif
     {
-      puts ("need root privileges");
-      exit (0);
+      uid_t uid = getuid ();
+      if (uid != 0)
+	{
+	  puts ("need root privileges");
+	  exit (0);
+	}
     }
-#endif
 
   size_t test_dir_len = strlen (test_dir);
   static const char dir_name[] = "/tst-fchownat.XXXXXX";

Modified: trunk/libc/libidn/ChangeLog
==============================================================================
--- trunk/libc/libidn/ChangeLog (original)
+++ trunk/libc/libidn/ChangeLog Thu Mar 27 06:22:15 2008
@@ -1,3 +1,8 @@
+2008-02-10  Jim Meyering  <meyering@xxxxxxxxxx>
+
+	* stringprep.c (stringprep, stringprep_profile): Remove useless
+	"if" before "free".
+
 2006-02-27  Roland McGrath  <roland@xxxxxxxxxx>
 
 	* Makefile: Use $(..) in place of ../.

Modified: trunk/libc/libidn/stringprep.c
==============================================================================
--- trunk/libc/libidn/stringprep.c (original)
+++ trunk/libc/libidn/stringprep.c Thu Mar 27 06:22:15 2008
@@ -366,8 +366,7 @@
 
   do
     {
-      if (ucs4)
-	free (ucs4);
+      free (ucs4);
       ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
       maxucs4len = ucs4len + adducs4len;
       uint32_t *newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
@@ -449,8 +448,7 @@
 
   do
     {
-      if (str)
-	free (str);
+      free (str);
       str = (char *) malloc (len);
       if (str == NULL)
 	return STRINGPREP_MALLOC_ERROR;

Modified: trunk/libc/libio/bits/stdio-ldbl.h
==============================================================================
--- trunk/libc/libio/bits/stdio-ldbl.h (original)
+++ trunk/libc/libio/bits/stdio-ldbl.h Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* -mlong-double-64 compatibility mode for stdio functions.
-   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008 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
@@ -85,5 +85,13 @@
 __LDBL_REDIR_DECL (__printf_chk)
 __LDBL_REDIR_DECL (__vfprintf_chk)
 __LDBL_REDIR_DECL (__vprintf_chk)
+#  ifdef __USE_GNU
+__LDBL_REDIR_DECL (__asprintf_chk)
+__LDBL_REDIR_DECL (__vasprintf_chk)
+__LDBL_REDIR_DECL (__dprintf_chk)
+__LDBL_REDIR_DECL (__vdprintf_chk)
+__LDBL_REDIR_DECL (__obstack_printf_chk)
+__LDBL_REDIR_DECL (__obstack_vprintf_chk)
+#  endif
 # endif
 #endif

Modified: trunk/libc/libio/bits/stdio2.h
==============================================================================
--- trunk/libc/libio/bits/stdio2.h (original)
+++ trunk/libc/libio/bits/stdio2.h Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Checking macros for stdio functions.
-   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007, 2008 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
@@ -127,6 +127,93 @@
 {
   return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
+
+# ifdef __USE_GNU
+
+extern int __asprintf_chk (char **__restrict __ptr, int __flag,
+			   __const char *__restrict __fmt, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
+extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
+			    __const char *__restrict __fmt, _G_va_list __arg)
+     __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
+extern int __dprintf_chk (int __fd, int __flag, __const char *__restrict __fmt,
+			  ...) __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __vdprintf_chk (int __fd, int __flag,
+			   __const char *__restrict __fmt, _G_va_list __arg)
+     __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
+				 int __flag, __const char *__restrict __format,
+				 ...)
+     __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
+				  int __flag,
+				  __const char *__restrict __format,
+				  _G_va_list __args)
+     __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+
+#  ifdef __va_arg_pack
+__extern_always_inline int
+__NTH (asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...))
+{
+  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
+			 __va_arg_pack ());
+}
+
+__extern_always_inline int
+__NTH (__asprintf (char **__restrict __ptr, __const char *__restrict __fmt,
+		   ...))
+{
+  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
+			 __va_arg_pack ());
+}
+
+__extern_always_inline int
+dprintf (int __fd, __const char *__restrict __fmt, ...)
+{
+  return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
+			__va_arg_pack ());
+}
+
+__extern_always_inline int
+__NTH (obstack_printf (struct obstack *__restrict __obstack,
+		       __const char *__restrict __fmt, ...))
+{
+  return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
+			       __va_arg_pack ());
+}
+#  elif !defined __cplusplus
+#   define asprintf(ptr, ...) \
+  __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+#   define __asprintf(ptr, ...) \
+  __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+#   define dprintf(fd, ...) \
+  __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+#   define obstack_printf(obstack, ...) \
+  __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+#  endif
+
+__extern_always_inline int
+__NTH (vasprintf (char **__restrict __ptr, __const char *__restrict __fmt,
+		  _G_va_list __ap))
+{
+  return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
+}
+
+__extern_always_inline int
+vdprintf (int __fd, __const char *__restrict __fmt, _G_va_list __ap)
+{
+  return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
+}
+
+__extern_always_inline int
+__NTH (obstack_vprintf (struct obstack *__restrict __obstack,
+			__const char *__restrict __fmt, _G_va_list __ap))
+{
+  return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
+				__ap);
+}
+
+# endif
 
 #endif
 

Modified: trunk/libc/libio/genops.c
==============================================================================
--- trunk/libc/libio/genops.c (original)
+++ trunk/libc/libio/genops.c Thu Mar 27 06:22:15 2008
@@ -300,8 +300,7 @@
 	memcpy (new_buffer + avail,
 		fp->_IO_read_base + least_mark,
 		needed_size);
-      if (fp->_IO_save_base)
-	free (fp->_IO_save_base);
+      free (fp->_IO_save_base);
       fp->_IO_save_base = new_buffer;
       fp->_IO_save_end = new_buffer + avail + needed_size;
     }

Modified: trunk/libc/libio/obprintf.c
==============================================================================
--- trunk/libc/libio/obprintf.c (original)
+++ trunk/libc/libio/obprintf.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Print output of stream to given obstack.
-   Copyright (C) 1996,1997,1999,2000,2001,2002,2003,2004,2005,2006
+   Copyright (C) 1996,1997,1999,2000,2001,2002,2003,2004,2005,2006,2008
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
@@ -95,7 +95,7 @@
 
 
 /* the jump table.  */
-static const struct _IO_jump_t _IO_obstack_jumps =
+const struct _IO_jump_t _IO_obstack_jumps attribute_hidden =
 {
   JUMP_INIT_DUMMY,
   JUMP_INIT(finish, NULL),

Modified: trunk/libc/libio/wgenops.c
==============================================================================
--- trunk/libc/libio/wgenops.c (original)
+++ trunk/libc/libio/wgenops.c Thu Mar 27 06:22:15 2008
@@ -553,8 +553,7 @@
 		  needed_size * sizeof (wchar_t));
 #endif
 	}
-      if (fp->_wide_data->_IO_save_base)
-	free (fp->_wide_data->_IO_save_base);
+      free (fp->_wide_data->_IO_save_base);
       fp->_wide_data->_IO_save_base = new_buffer;
       fp->_wide_data->_IO_save_end = new_buffer + avail + needed_size;
     }

Modified: trunk/libc/locale/iso-639.def
==============================================================================
--- trunk/libc/locale/iso-639.def (original)
+++ trunk/libc/locale/iso-639.def Thu Mar 27 06:22:15 2008
@@ -391,6 +391,7 @@
 DEFINE_LANGUAGE_CODE3 ("Serer", srr, srr)
 DEFINE_LANGUAGE_CODE3 ("Shan", shn, shn)
 DEFINE_LANGUAGE_CODE ("Shona", sn, sna, sna)
+DEFINE_LANGUAGE_CODE3 ("Shuswap", shs, shs)
 DEFINE_LANGUAGE_CODE ("Sichuan Yi", ii, iii, iii)
 DEFINE_LANGUAGE_CODE3 ("Sicilian", scn, scn)
 DEFINE_LANGUAGE_CODE3 ("Sidamo", sid, sid)

Modified: trunk/libc/locale/programs/ld-collate.c
==============================================================================
--- trunk/libc/locale/programs/ld-collate.c (original)
+++ trunk/libc/locale/programs/ld-collate.c Thu Mar 27 06:22:15 2008
@@ -2819,10 +2819,8 @@
 		col_elem_free:
 		  if (symbol != NULL)
 		    free ((char *) symbol);
-		  if (arg->val.str.startmb != NULL)
-		    free (arg->val.str.startmb);
-		  if (arg->val.str.startwc != NULL)
-		    free (arg->val.str.startwc);
+		  free (arg->val.str.startmb);
+		  free (arg->val.str.startwc);
 		}
 	      lr_ignore_rest (ldfile, 1);
 	    }
@@ -2968,10 +2966,8 @@
 	      else
 		{
 		col_sym_free:
-		  if (symbol != NULL)
-		    free (symbol);
-		  if (endsymbol != NULL)
-		    free (endsymbol);
+		  free (symbol);
+		  free (endsymbol);
 		}
 	    }
 	  break;

Modified: trunk/libc/locale/programs/linereader.c
==============================================================================
--- trunk/libc/locale/programs/linereader.c (original)
+++ trunk/libc/locale/programs/linereader.c Thu Mar 27 06:22:15 2008
@@ -859,8 +859,7 @@
       if (illegal_string)
 	{
 	  free (buf);
-	  if (buf2 != NULL)
-	    free (buf2);
+	  free (buf2);
 	  lr->token.val.str.startmb = NULL;
 	  lr->token.val.str.lenmb = 0;
 	  lr->token.val.str.startwc = NULL;

Modified: trunk/libc/localedata/ChangeLog
==============================================================================
--- trunk/libc/localedata/ChangeLog (original)
+++ trunk/libc/localedata/ChangeLog Thu Mar 27 06:22:15 2008
@@ -1,3 +1,31 @@
+2008-03-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* locales/iso14651_t1_common: Add support for Devanagari script.
+	* locales/mr_IN: Adjust Devanagari sorting for mr_IN.
+	Patch by Pravin Satpute <psatpute@xxxxxxxxxx>.
+
+2008-03-08  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5602]
+	* locales/pt_PT: Fix mon_decimal_point.
+
+2008-03-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5777]
+	* locales/es_CR: Define am/pm format.
+
+2008-03-04  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* SUPPORTED (SUPPORTED-LOCALES): Add shs_CA.UTF-8.
+
+	* locales/en_CA: Add language information in LC_ADDRESS section.
+	* locales/fr_CA: Likewise.
+	* locales/ik_CA: Likewise.
+	* locales/iu_CA: Likewise.
+
+	[BZ #5627]
+	* locales/shs_CA: New file.
+
 2008-01-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #5520]

Modified: trunk/libc/localedata/SUPPORTED
==============================================================================
--- trunk/libc/localedata/SUPPORTED (original)
+++ trunk/libc/localedata/SUPPORTED Thu Mar 27 06:22:15 2008
@@ -325,6 +325,7 @@
 sa_IN/UTF-8 \
 sc_IT/UTF-8 \
 se_NO/UTF-8 \
+shs_CA/UTF-8 \
 si_LK/UTF-8 \
 sid_ET/UTF-8 \
 sk_SK.UTF-8/UTF-8 \

Modified: trunk/libc/localedata/locales/en_CA
==============================================================================
--- trunk/libc/localedata/locales/en_CA (original)
+++ trunk/libc/localedata/locales/en_CA Thu Mar 27 06:22:15 2008
@@ -170,4 +170,8 @@
 country_ab2 "<U0043><U0041>"
 country_ab3 "<U0043><U0041><U004E>"
 country_num 124
+lang_name     "<U0045><U006E><U0067><U006C><U0069><U0073><U0068>"
+lang_ab       "<U0065><U006E>"
+lang_term     "<U0065><U006E><U0067>"
+lang_lib      "<U0065><U006E><U0067>"
 END LC_ADDRESS

Modified: trunk/libc/localedata/locales/es_CR
==============================================================================
--- trunk/libc/localedata/locales/es_CR (original)
+++ trunk/libc/localedata/locales/es_CR Thu Mar 27 06:22:15 2008
@@ -108,8 +108,8 @@
 d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
 d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
 t_fmt   "<U0025><U0054>"
-am_pm   "";""
-t_fmt_ampm ""
+am_pm   "<U0061><U002E><U006D><U002E>";"<U0070><U002E><U006D><U002E>"
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
 date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"

Modified: trunk/libc/localedata/locales/fr_CA
==============================================================================
--- trunk/libc/localedata/locales/fr_CA (original)
+++ trunk/libc/localedata/locales/fr_CA Thu Mar 27 06:22:15 2008
@@ -149,4 +149,8 @@
 country_ab2 "<U0043><U0041>"
 country_ab3 "<U0043><U0041><U004E>"
 country_num 124
+lang_name "<U0046><U0072><U0061><U006E><U00E7><U0061><U0069><U0073>"
+lang_ab   "<U0066><U0072>"
+lang_term "<U0066><U0072><U0061>"
+lang_lib  "<U0066><U0072><U0065>"
 END LC_ADDRESS

Modified: trunk/libc/localedata/locales/ik_CA
==============================================================================
--- trunk/libc/localedata/locales/ik_CA (original)
+++ trunk/libc/localedata/locales/ik_CA Thu Mar 27 06:22:15 2008
@@ -225,6 +225,13 @@
 
 LC_ADDRESS
 % FIXME
-copy "en_CA"
+postal_fmt    "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0043><U0041>"
+country_ab3 "<U0043><U0041><U004E>"
+country_num 124
 END LC_ADDRESS
 

Modified: trunk/libc/localedata/locales/iso14651_t1_common
==============================================================================
--- trunk/libc/localedata/locales/iso14651_t1_common (original)
+++ trunk/libc/localedata/locales/iso14651_t1_common Thu Mar 27 06:22:15 2008
@@ -60,6 +60,7 @@
 script <CYRIL>
 script <ARMENIAN>
 script <GEORGIAN>
+script <DEVANAGARI>
 
 # Déclaration des symboles internes / Declaration of internal symbols
 #
@@ -460,6 +461,105 @@
 collating-symbol <GEORG-HAR>
 collating-symbol <GEORG-HOE>
 collating-symbol <GEORG-FI>
+#
+# <DEVANAGARI>
+#
+# dvd- denotes vowel modifier
+# dm-  denotes matras
+# dvw- denotes vowels
+# <NKT> denotes Nukta characters
+# <NUM> denotes Numerals
+#
+# defning symbols
+collating-symbol <NUM>
+collating-symbol <NKT>
+collating-symbol <dv-abbrevation>
+collating-symbol <dom> 
+collating-symbol <dvw-shorta> 
+collating-symbol <dvw-a> 
+collating-symbol <dvw-aa> 
+collating-symbol <dvw-i> 
+collating-symbol <dvw-ii> 
+collating-symbol <dvw-u> 
+collating-symbol <dvw-uu> 
+collating-symbol <dvw-vocalicr> 
+collating-symbol <dvw-vocalicrr> 
+collating-symbol <dvw-vocalicl> 
+collating-symbol <dvw-vocalicll> 
+collating-symbol <dvw-candrae> 
+collating-symbol <dvw-shorte> 
+collating-symbol <dvw-e> 
+collating-symbol <dvw-ai> 
+collating-symbol <dvw-candrao> 
+collating-symbol <dvw-shorto> 
+collating-symbol <dvw-o> 
+collating-symbol <dvw-au> 
+collating-symbol <d_ka> 
+collating-symbol <d_kha> 
+collating-symbol <d_ga> 
+collating-symbol <d_gga> 
+collating-symbol <d_gha> 
+collating-symbol <d_nga> 
+collating-symbol <d_ca> 
+collating-symbol <d_cha> 
+collating-symbol <d_ja> 
+collating-symbol <d_jja> 
+collating-symbol <d_jha> 
+collating-symbol <d_nya> 
+collating-symbol <d_tta> 
+collating-symbol <d_ttha> 
+collating-symbol <d_dda> 
+collating-symbol <d_ddda> 
+collating-symbol <d_ddha> 
+collating-symbol <d_nna> 
+collating-symbol <d_ta> 
+collating-symbol <d_tha> 
+collating-symbol <d_da> 
+collating-symbol <d_dha> 
+collating-symbol <d_na> 
+collating-symbol <d_pa> 
+collating-symbol <d_pha> 
+collating-symbol <d_ba> 
+collating-symbol <d_bba>
+collating-symbol <d_bha> 
+collating-symbol <d_ma> 
+collating-symbol <d_ya> 
+collating-symbol <d_ra> 
+collating-symbol <d_la> 
+collating-symbol <d_lla> 
+collating-symbol <d_va> 
+collating-symbol <d_sha> 
+collating-symbol <d_ssa> 
+collating-symbol <d_sa> 
+collating-symbol <d_ha> 
+collating-symbol <d_avagrah> 
+collating-symbol <d_glo-stop> 
+collating-symbol <dm-aa> 
+collating-symbol <dm-i> 
+collating-symbol <dm-ii> 
+collating-symbol <dm-u> 
+collating-symbol <dm-uu>
+collating-symbol <dm-vocalicr> 
+collating-symbol <dm-vocalicrr> 
+collating-symbol <dm-vocalicl> 
+collating-symbol <dm-vocalicll> 
+collating-symbol <dm-candrae> 
+collating-symbol <dm-shorte> 
+collating-symbol <dm-e> 
+collating-symbol <dm-ai> 
+collating-symbol <dm-candrao> 
+collating-symbol <dm-shorto> 
+collating-symbol <dm-o> 
+collating-symbol <dm-au> 
+collating-symbol <dvd-anuswara> 
+collating-symbol <dvd-chandrabindu>
+collating-symbol <dvd-visarg>
+collating-symbol <d_halant>
+collating-symbol <d_udatta>
+collating-symbol <d_anudatta>
+collating-symbol <dv-grave>
+collating-symbol <dv-acute>
+
 
 # Ordre des symboles internes / Order of internal symbols
 #
@@ -872,6 +972,98 @@
 <GEORG-HAE>
 <GEORG-HOE>
 <GEORG-FI>
+#
+#<DEVANAGARI>
+#
+# collation weights in order
+<NKT>
+<NUM>
+<d_udatta>
+<d_anudatta>
+<dv-grave>
+<dv-acute>
+<dv-abbrevation>
+<dom> 
+<dvw-shorta> 
+<dvw-a> 
+<dvw-aa> 
+<dvw-i> 
+<dvw-ii> 
+<dvw-u> 
+<dvw-uu> 
+<dvw-vocalicr> 
+<dvw-vocalicrr> 
+<dvw-vocalicl> 
+<dvw-vocalicll> 
+<dvw-candrae> 
+<dvw-shorte> 
+<dvw-e> 
+<dvw-ai> 
+<dvw-candrao> 
+<dvw-shorto> 
+<dvw-o> 
+<dvw-au> 
+<d_ka> 
+<d_kha> 
+<d_ga> 
+<d_gga> 
+<d_gha> 
+<d_nga> 
+<d_ca> 
+<d_cha> 
+<d_ja> 
+<d_jja> 
+<d_jha> 
+<d_nya> 
+<d_tta> 
+<d_ttha> 
+<d_dda> 
+<d_ddda> 
+<d_ddha> 
+<d_nna> 
+<d_ta> 
+<d_tha> 
+<d_da> 
+<d_dha> 
+<d_na> 
+<d_pa> 
+<d_pha> 
+<d_ba> 
+<d_bba>
+<d_bha> 
+<d_ma> 
+<d_ya> 
+<d_ra> 
+<d_la> 
+<d_lla> 
+<d_va> 
+<d_sha> 
+<d_ssa> 
+<d_sa> 
+<d_ha> 
+<d_avagrah> 
+<d_glo-stop> 
+<dm-aa> 
+<dm-i> 
+<dm-ii> 
+<dm-u> 
+<dm-uu>
+<dm-vocalicr> 
+<dm-vocalicrr> 
+<dm-vocalicl> 
+<dm-vocalicll> 
+<dm-candrae> 
+<dm-shorte> 
+<dm-e> 
+<dm-ai> 
+<dm-candrao> 
+<dm-shorto> 
+<dm-o> 
+<dm-au> 
+<dvd-anuswara>
+<dvd-chandrabindu>
+<dvd-visarg>
+<d_halant>
 
 order_start <SPECIAL>;forward;backward;forward;forward,position
 #
@@ -2639,6 +2831,116 @@
 <U2D24> <GEORG-HAR>;<BAS>;<ANO>;IGNORE
 <U2D25> <GEORG-HOE>;<BAS>;<ANO>;IGNORE
 
+order_start <DEVANAGARI>;forward;forward;forward;forward,position
+<U0970> <dv-abbrevation>;<BAS>;<MIN>;IGNORE
+<U0966> <0>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0967> <1>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0968> <2>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0969> <3>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U096A> <4>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U096B> <5>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U096C> <6>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U096D> <7>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U096E> <8>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U096F> <9>;"<BAS><NUM>";"<MIN><MIN>";IGNORE
+<U0950> <dom> ;<BAS>;<MIN>;IGNORE 
+<U0904>  <dvw-shorta> ;<BAS>;<MIN>;IGNORE
+<U0905> <dvw-a> ;<BAS>;<MIN>;IGNORE
+<U0906> <dvw-aa> ;<BAS>;<MIN>;IGNORE
+<U0907> <dvw-i> ;<BAS>;<MIN>;IGNORE
+<U0908> <dvw-ii> ;<BAS>;<MIN>;IGNORE
+<U0909> <dvw-u> ;<BAS>;<MIN>;IGNORE
+<U090A> <dvw-uu>;<BAS>;<MIN>;IGNORE 
+<U090B> <dvw-vocalicr>;<BAS>;<MIN>;IGNORE 
+<U0960> <dvw-vocalicrr>;<BAS>;<MIN>;IGNORE 
+<U090C> <dvw-vocalicl>;<BAS>;<MIN>;IGNORE 
+<U0961> <dvw-vocalicll>;<BAS>;<MIN>;IGNORE 
+<U090D> <dvw-candrae>;<BAS>;<MIN>;IGNORE 
+<U090E> <dvw-shorte>;<BAS>;<MIN>;IGNORE 
+<U090F> <dvw-e>;<BAS>;<MIN>;IGNORE 
+<U0910> <dvw-ai>;<BAS>;<MIN>;IGNORE 
+<U0911> <dvw-candrao>;<BAS>;<MIN>;IGNORE 
+<U0912> <dvw-shorto>;<BAS>;<MIN>;IGNORE 
+<U0913> <dvw-o>;<BAS>;<MIN>;IGNORE 
+<U0914> <dvw-au>;<BAS>;<MIN>;IGNORE
+<U0915> <d_ka>;<BAS>;<MIN>;IGNORE 
+<U0958> <d_ka>;"<BAS><NKT>";"<MIN><MIN>";IGNORE 
+<U0916> <d_kha>;<BAS>;<MIN>;IGNORE 
+<U0959> <d_kha>;"<BAS><NKT>";"<MIN><MIN>";IGNORE 
+<U0917> <d_ga>;<BAS>;<MIN>;IGNORE 
+<U095A> <d_ga>;"<BAS><NKT>";"<MIN><MIN>";IGNORE 
+<U097B> <d_gga>;<BAS>;<MIN>;IGNORE 
+<U0918> <d_gha>;<BAS>;<MIN>;IGNORE
+<U0919> <d_nga>;<BAS>;<MIN>;IGNORE 
+<U091A> <d_ca>;<BAS>;<MIN>;IGNORE 
+<U091B> <d_cha>;<BAS>;<MIN>;IGNORE 
+<U091C> <d_ja>;<BAS>;<MIN>;IGNORE 
+<U095B> <d_ja>;"<BAS><NKT>";"<MIN><MIN>";IGNORE 
+<U097C> <d_jja>;<BAS>;<MIN>;IGNORE 
+<U091D> <d_jha>;<BAS>;<MIN>;IGNORE 
+<U091E> <d_nya>;<BAS>;<MIN>;IGNORE 
+<U091F> <d_tta>;<BAS>;<MIN>;IGNORE 
+<U0920> <d_ttha>;<BAS>;<MIN>;IGNORE 
+<U0921> <d_dda>;<BAS>;<MIN>;IGNORE 
+<U095C> <d_dda>;"<BAS><NKT>";"<MIN><MIN>";IGNORE
+<U097E> <d_ddda>;<BAS>;<MIN>;IGNORE 
+<U0922> <d_ddha>;<BAS>;<MIN>;IGNORE 
+<U095D> <d_ddha>;"<BAS><NKT>";"<MIN><MIN>";IGNORE
+<U0923> <d_nna>;<BAS>;<MIN>;IGNORE 
+<U0924> <d_ta>;<BAS>;<MIN>;IGNORE 
+<U0925> <d_tha>;<BAS>;<MIN>;IGNORE 
+<U0926> <d_da>;<BAS>;<MIN>;IGNORE 
+<U0927> <d_dha>;<BAS>;<MIN>;IGNORE 
+<U0928> <d_na>;<BAS>;<MIN>;IGNORE 
+<U0929> <d_na>;"<BAS><NKT>";"<MIN><MIN>";IGNORE
+<U092A> <d_pa>;<BAS>;<MIN>;IGNORE 
+<U092B> <d_pha>;<BAS>;<MIN>;IGNORE 
+<U095E> <d_pha>;"<BAS><NKT>";"<MIN><MIN>";IGNORE
+<U092C> <d_ba>;<BAS>;<MIN>;IGNORE 
+<U097F> <d_bba>;<BAS>;<MIN>;IGNORE 
+<U092D> <d_bha>;<BAS>;<MIN>;IGNORE 
+<U092E> <d_ma>;<BAS>;<MIN>;IGNORE 
+<U092F> <d_ya>;<BAS>;<MIN>;IGNORE 
+<U095F> <d_ya>;"<BAS><NKT>";"<MIN><MIN>";IGNORE
+<U0930> <d_ra>;<BAS>;<MIN>;IGNORE 
+<U0931> <d_ra>;"<BAS><NKT>";"<MIN><MIN>";IGNORE
+<U0932> <d_la>;<BAS>;<MIN>;IGNORE 
+<U0933> <d_lla>;<BAS>;<MIN>;IGNORE 
+<U0934> <d_lla>;"<BAS><NKT>";"<MIN><MIN>";IGNORE
+<U0935> <d_va>;<BAS>;<MIN>;IGNORE 
+<U0936> <d_sha>;<BAS>;<MIN>;IGNORE 
+<U0937> <d_ssa>;<BAS>;<MIN>;IGNORE 
+<U0938> <d_sa>;<BAS>;<MIN>;IGNORE 
+<U0939> <d_ha>;<BAS>;<MIN>;IGNORE 
+<U093D> <d_avagrah>;<BAS>;<MIN>;IGNORE 
+<U097D> <d_glo-stop>;<BAS>;<MIN>;IGNORE 
+<U093E> <dm-aa>;<BAS>;<MIN>;IGNORE 
+<U093F> <dm-i>;<BAS>;<MIN>;IGNORE 
+<U0940> <dm-ii>;<BAS>;<MIN>;IGNORE 
+<U0941> <dm-u>;<BAS>;<MIN>;IGNORE 
+<U0942> <dm-uu>;<BAS>;<MIN>;IGNORE
+<U0943> <dm-vocalicr>;<BAS>;<MIN>;IGNORE 
+<U0944> <dm-vocalicrr>;<BAS>;<MIN>;IGNORE 
+<U0962> <dm-vocalicl>;<BAS>;<MIN>;IGNORE 
+<U0963> <dm-vocalicll>;<BAS>;<MIN>;IGNORE 
+<U0945> <dm-candrae>;<BAS>;<MIN>;IGNORE 
+<U0946>  <dm-shorte>;<BAS>;<MIN>;IGNORE 
+<U0947> <dm-e>;<BAS>;<MIN>;IGNORE 
+<U0948> <dm-ai>;<BAS>;<MIN>;IGNORE 
+<U0949> <dm-candrao>;<BAS>;<MIN>;IGNORE 
+<U094A> <dm-shorto>;<BAS>;<MIN>;IGNORE 
+<U094B> <dm-o>;<BAS>;<MIN>;IGNORE 
+<U094C> <dm-au>;<BAS>;<MIN>;IGNORE 
+<U0902> <dvd-anuswara>;<BAS>;<MIN>;IGNORE
+<U0901> <dvd-chandrabindu>;<BAS>;<MIN>;IGNORE
+<U0903> <dvd-visarg>;<BAS>;<MIN>;IGNORE
+<U094D> <d_halant>;<BAS>;<MIN>;IGNORE
+<U093C> IGNORE;<NKT>;<MIN>;IGNORE 
+<U0951> IGNORE;<d_udatta>;<MIN>;IGNORE
+<U0952> IGNORE;<d_anudatta>;<MIN>;IGNORE
+<U0953> IGNORE;<dv-grave>;<MIN>;IGNORE
+<U0954> IGNORE;<dv-acute>;<MIN>;IGNORE
+
 order_end
 
 END LC_COLLATE

Modified: trunk/libc/localedata/locales/iu_CA
==============================================================================
--- trunk/libc/localedata/locales/iu_CA (original)
+++ trunk/libc/localedata/locales/iu_CA Thu Mar 27 06:22:15 2008
@@ -44,9 +44,9 @@
 country_car "<U0043><U0041><U004E>" % FIXME
 % FIXME country_isbn for Canada/inuktitut ?
 lang_name "<U1403><U14C4><U1483><U144E><U1450><U1466>"
-lang_ab "iu"
-% FIXME lang_term 
-% FIXME lang_lib 
+lang_ab "<U0069><U0075>"
+lang_term "<U0069><U006B><U0075>"
+lang_lib  "<U0069><U006B><U0075>"
 END LC_ADDRESS
 
 %%%%%%%%%%%%%

Modified: trunk/libc/localedata/locales/mr_IN
==============================================================================
--- trunk/libc/localedata/locales/mr_IN (original)
+++ trunk/libc/localedata/locales/mr_IN Thu Mar 27 06:22:15 2008
@@ -43,6 +43,27 @@
 
 % Copy the template from ISO/IEC 14651
 copy "iso14651_t1"
+
+% customize sorting required for mr_IN
+collating-element <dv_ksha> from "<U0915><U094D><U0937>"
+collating-element <dv_dnya> from "<U091C><U094D><U091E>"
+collating-element <dv_shra> from "<U0936><U094D><U0930>"
+
+collating-symbol <d_ksha>
+collating-symbol <d_dnya>
+collating-symbol <d_shra>
+
+reorder-after <d_ha>
+<d_ksha>
+<d_dnya>
+<d_shra>
+
+reorder-after <U0939>
+<dv_ksha> <d_ksha>;<BAS>;<MIN>;IGNORE 
+<dv_dnya> <d_dnya>;<BAS>;<MIN>;IGNORE 
+<dv_shra> <d_shra>;<BAS>;<MIN>;IGNORE
+
+reorder-end
 
 END LC_COLLATE
 

Modified: trunk/libc/localedata/locales/pt_PT
==============================================================================
--- trunk/libc/localedata/locales/pt_PT (original)
+++ trunk/libc/localedata/locales/pt_PT Thu Mar 27 06:22:15 2008
@@ -65,7 +65,7 @@
 LC_MONETARY
 int_curr_symbol           "<U0045><U0055><U0052><U0020>"
 currency_symbol           "<U20AC>"
-mon_decimal_point         "<U0024>"
+mon_decimal_point         "<U002C>"
 mon_thousands_sep         "<U002E>"
 mon_grouping              3;3
 positive_sign             ""

Modified: trunk/libc/malloc/malloc.c
==============================================================================
--- trunk/libc/malloc/malloc.c (original)
+++ trunk/libc/malloc/malloc.c Thu Mar 27 06:22:15 2008
@@ -1186,7 +1186,7 @@
 
   Malloc_trim returns 1 if it actually released any memory, else 0.
   On systems that do not support "negative sbrks", it will always
-  rreturn 0.
+  return 0.
 */
 #if __STD_C
 int      public_mTRIm(size_t);

Modified: trunk/libc/math/libm-test.inc
==============================================================================
--- trunk/libc/math/libm-test.inc (original)
+++ trunk/libc/math/libm-test.inc Thu Mar 27 06:22:15 2008
@@ -4482,6 +4482,11 @@
   TEST_f_f (nearbyint, -0.5, minus_zero);
   TEST_f_f (nearbyint, -1.5, -2.0);
 
+  TEST_f_f (nearbyint, 262144.75, 262145.0);
+  TEST_f_f (nearbyint, 262142.75, 262143.0);
+  TEST_f_f (nearbyint, 524286.75, 524287.0);
+  TEST_f_f (nearbyint, 524288.75, 524289.0);
+
   END (nearbyint);
 }
 
@@ -4853,6 +4858,10 @@
   TEST_f_f (rint, -0.1, -0.0);
   TEST_f_f (rint, -0.25, -0.0);
   TEST_f_f (rint, -0.625, -1.0);
+  TEST_f_f (rint, 262144.75, 262145.0);
+  TEST_f_f (rint, 262142.75, 262143.0);
+  TEST_f_f (rint, 524286.75, 524287.0);
+  TEST_f_f (rint, 524288.75, 524289.0);
 #ifdef TEST_LDOUBLE
   /* The result can only be represented in long double.  */
   TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);

Modified: trunk/libc/misc/sys/queue.h
==============================================================================
--- trunk/libc/misc/sys/queue.h (original)
+++ trunk/libc/misc/sys/queue.h Thu Mar 27 06:22:15 2008
@@ -271,6 +271,14 @@
 		(var);							\
 		(var) = ((var)->field.stqe_next))
 
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
 /*
  * Singly-linked Tail queue access methods.
  */
@@ -434,6 +442,15 @@
 		(var);							\
 		(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
 
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
 /*
  * Tail queue access methods.
  */

Modified: trunk/libc/nis/nis_call.c
==============================================================================
--- trunk/libc/nis/nis_call.c (original)
+++ trunk/libc/nis/nis_call.c Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2001, 2004, 2005, 2006, 2007
+/* Copyright (C) 1997, 1998, 2001, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxxxxxxxxxxxxxx>, 1997.
@@ -592,8 +592,10 @@
   XDR xdrs;
   struct stat64 st;
 
+  int saved_errno = errno;
   if (stat64 ("/var/nis/NIS_COLD_START", &st) < 0)
     st.st_mtime = nis_cold_start_mtime + 1;
+  __set_errno (saved_errno);
 
   __libc_lock_lock (nis_server_cache_lock);
 
@@ -741,7 +743,9 @@
       return result;
     }
 
+  int saved_errno = errno;
   *dir = readColdStartFile ();
+  __set_errno (saved_errno);
   if (*dir == NULL)
     /* No /var/nis/NIS_COLD_START->no NIS+ installed.  */
     return NIS_UNAVAIL;

Modified: trunk/libc/nis/nss_compat/compat-pwd.c
==============================================================================
--- trunk/libc/nis/nss_compat/compat-pwd.c (original)
+++ trunk/libc/nis/nss_compat/compat-pwd.c Thu Mar 27 06:22:15 2008
@@ -116,16 +116,11 @@
 static void
 give_pwd_free (struct passwd *pwd)
 {
-  if (pwd->pw_name != NULL)
-    free (pwd->pw_name);
-  if (pwd->pw_passwd != NULL)
-    free (pwd->pw_passwd);
-  if (pwd->pw_gecos != NULL)
-    free (pwd->pw_gecos);
-  if (pwd->pw_dir != NULL)
-    free (pwd->pw_dir);
-  if (pwd->pw_shell != NULL)
-    free (pwd->pw_shell);
+  free (pwd->pw_name);
+  free (pwd->pw_passwd);
+  free (pwd->pw_gecos);
+  free (pwd->pw_dir);
+  free (pwd->pw_shell);
 
   memset (pwd, '\0', sizeof (struct passwd));
 }

Modified: trunk/libc/nis/nss_compat/compat-spwd.c
==============================================================================
--- trunk/libc/nis/nss_compat/compat-spwd.c (original)
+++ trunk/libc/nis/nss_compat/compat-spwd.c Thu Mar 27 06:22:15 2008
@@ -113,10 +113,8 @@
 static void
 give_spwd_free (struct spwd *pwd)
 {
-  if (pwd->sp_namp != NULL)
-    free (pwd->sp_namp);
-  if (pwd->sp_pwdp != NULL)
-    free (pwd->sp_pwdp);
+  free (pwd->sp_namp);
+  free (pwd->sp_pwdp);
 
   memset (pwd, '\0', sizeof (struct spwd));
   pwd->sp_warn = -1;

Modified: trunk/libc/nis/ypclnt.c
==============================================================================
--- trunk/libc/nis/ypclnt.c (original)
+++ trunk/libc/nis/ypclnt.c Thu Mar 27 06:22:15 2008
@@ -634,7 +634,7 @@
 			 (caddr_t) &req, (xdrproc_t) xdr_ypresp_order,
 			 (caddr_t) &resp);
 
-  if (result == YPERR_SUCCESS)
+  if (result != YPERR_SUCCESS)
     return result;
 
   *outorder = resp.ordernum;

Modified: trunk/libc/nptl/ChangeLog
==============================================================================
--- trunk/libc/nptl/ChangeLog (original)
+++ trunk/libc/nptl/ChangeLog Thu Mar 27 06:22:15 2008
@@ -1,3 +1,23 @@
+2008-03-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/ia64/dl-sysdep.h: Use __ASSEMBLER__ instead
+	of ASSEMBLER.
+	* sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/i386/dl-sysdep.h: Likewise.
+
+2008-03-14  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/i386/dl-sysdep.h: Define
+	HAVE_DL_DISCOVER_OSVERSION.
+	* sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/dl-sysdep.h: Likewise.
+
+2008-03-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5778]
+	* sysdeps/unix/sysv/linux/bits/posix_opt.h: Change
+	_POSIX_CHOWN_RESTRICTED value to zero.
+
 2008-01-31  Roland McGrath  <roland@xxxxxxxxxx>
 
 	* Makefile (omit-deps): Variable removed.

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Define POSIX options for Linux.
-   Copyright (C) 1996-2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2004, 2006, 2008 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
@@ -47,8 +47,8 @@
 /* Setting of memory protections is supported.  */
 #define	_POSIX_MEMORY_PROTECTION	200112L
 
-/* Only root can change owner of file.  */
-#define	_POSIX_CHOWN_RESTRICTED	1
+/* Some filesystems allow all users to change file ownership.  */
+#define	_POSIX_CHOWN_RESTRICTED	0
 
 /* `c_cc' member of 'struct termios' structure can be disabled by
    using the value _POSIX_VDISABLE.  */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/dl-sysdep.h
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/dl-sysdep.h (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/dl-sysdep.h Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  IA-32 version.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2008 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
@@ -61,4 +61,13 @@
        ".previous;");
 #endif
 
+
+/* The _dl_discover_osversion function is so far only needed in sysconf
+   to check for kernels later than 2.6.23.  */
+#if !defined __ASSEMBLER__ && __LINUX_KERNEL_VERSION < 0x020617
+/* Get version of the OS.  */
+extern int _dl_discover_osversion (void) attribute_hidden;
+# define HAVE_DL_DISCOVER_OSVERSION	1
+#endif
+
 #endif	/* dl-sysdep.h */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  IA-32 version.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2008 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
@@ -58,4 +58,13 @@
        ".previous");
 #endif
 
+
+/* The _dl_discover_osversion function is so far only needed in sysconf
+   to check for kernels later than 2.6.23.  */
+#if !defined __ASSEMBLER__ && __LINUX_KERNEL_VERSION < 0x020617
+/* Get version of the OS.  */
+extern int _dl_discover_osversion (void) attribute_hidden;
+# define HAVE_DL_DISCOVER_OSVERSION	1
+#endif
+
 #endif	/* dl-sysdep.h */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  IA-64 version.
-   Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006, 2008 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
@@ -65,4 +65,13 @@
    might write into it after _dl_start returns.  */
 #define DL_ARGV_NOT_RELRO 1
 
+
+/* The _dl_discover_osversion function is so far only needed in sysconf
+   to check for kernels later than 2.6.23.  */
+#if !defined __ASSEMBLER__ && __LINUX_KERNEL_VERSION < 0x020617
+/* Get version of the OS.  */
+extern int _dl_discover_osversion (void) attribute_hidden;
+# define HAVE_DL_DISCOVER_OSVERSION	1
+#endif
+
 #endif	/* dl-sysdep.h */

Modified: trunk/libc/nptl_db/ChangeLog
==============================================================================
--- trunk/libc/nptl_db/ChangeLog (original)
+++ trunk/libc/nptl_db/ChangeLog Thu Mar 27 06:22:15 2008
@@ -1,3 +1,12 @@
+2008-03-25  Roland McGrath  <roland@xxxxxxxxxx>
+
+	[BZ #5983]
+	* structs.def: Add pid field of struct pthread.
+	* td_ta_thr_iter.c (iterate_thread_list): Take new arg MATCH_PID.
+	If a thread's pid does not match nor is < 0 while its tid matches
+	nor is < 0 and equal to -MATCH_PID, ignore it.
+	* td_thr_validate.c (td_thr_validate): Validate thread's pid/tid.
+
 2007-05-16  Roland McGrath  <roland@xxxxxxxxxx>
 
 	* td_thr_get_info.c: Fake the results for TH->th_unique == 0.

Modified: trunk/libc/nptl_db/structs.def
==============================================================================
--- trunk/libc/nptl_db/structs.def (original)
+++ trunk/libc/nptl_db/structs.def Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* List of types and symbols in libpthread examined by libthread_db.
-   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007, 2008 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
@@ -27,6 +27,7 @@
 DB_STRUCT_FIELD (pthread, list)
 DB_STRUCT_FIELD (pthread, report_events)
 DB_STRUCT_FIELD (pthread, tid)
+DB_STRUCT_FIELD (pthread, pid)
 DB_STRUCT_FIELD (pthread, start_routine)
 DB_STRUCT_FIELD (pthread, cancelhandling)
 DB_STRUCT_FIELD (pthread, schedpolicy)

Modified: trunk/libc/nptl_db/td_ta_thr_iter.c
==============================================================================
--- trunk/libc/nptl_db/td_ta_thr_iter.c (original)
+++ trunk/libc/nptl_db/td_ta_thr_iter.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,5 @@
 /* Iterate over a process's threads.
-   Copyright (C) 1999,2000,2001,2002,2003,2004,2007
+   Copyright (C) 1999,2000,2001,2002,2003,2004,2007,2008
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1999.
@@ -25,7 +25,7 @@
 static td_err_e
 iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback,
 		     void *cbdata_p, td_thr_state_e state, int ti_pri,
-		     psaddr_t head, bool fake_empty)
+		     psaddr_t head, bool fake_empty, pid_t match_pid)
 {
   td_err_e err;
   psaddr_t next, ofs;
@@ -78,28 +78,48 @@
       if (ps_pdread (ta->ph, addr, copy, ta->ta_sizeof_pthread) != PS_OK)
 	return TD_ERR;
 
-      err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread,
-				schedpolicy, 0);
-      if (err != TD_OK)
-	break;
-      err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread,
-				schedparam_sched_priority, 0);
+      /* Verify that this thread's pid field matches the child PID.
+	 If its pid field is negative, it's about to do a fork or it
+	 is the sole thread in a fork child.  */
+      psaddr_t pid;
+      err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, pid, 0);
+      if (err == TD_OK && (pid_t) (uintptr_t) pid < 0)
+	{
+	  if (-(pid_t) (uintptr_t) pid == match_pid)
+	    /* It is about to do a fork, but is really still the parent PID.  */
+	    pid = (psaddr_t) (uintptr_t) match_pid;
+	  else
+	    /* It must be a fork child, whose new PID is in the tid field.  */
+	    err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, tid, 0);
+	}
       if (err != TD_OK)
 	break;
 
-      /* Now test whether this thread matches the specified conditions.  */
+      if ((pid_t) (uintptr_t) pid == match_pid)
+	{
+	  err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread,
+				    schedpolicy, 0);
+	  if (err != TD_OK)
+	    break;
+	  err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread,
+				    schedparam_sched_priority, 0);
+	  if (err != TD_OK)
+	    break;
 
-      /* Only if the priority level is as high or higher.  */
-      int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER
-		       ? 0 : (uintptr_t) schedprio);
-      if (descr_pri >= ti_pri)
-	{
-	  /* Yep, it matches.  Call the callback function.  */
-	  td_thrhandle_t th;
-	  th.th_ta_p = (td_thragent_t *) ta;
-	  th.th_unique = addr;
-	  if (callback (&th, cbdata_p) != 0)
-	    return TD_DBERR;
+	  /* Now test whether this thread matches the specified conditions.  */
+
+	  /* Only if the priority level is as high or higher.  */
+	  int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER
+			   ? 0 : (uintptr_t) schedprio);
+	  if (descr_pri >= ti_pri)
+	    {
+	      /* Yep, it matches.  Call the callback function.  */
+	      td_thrhandle_t th;
+	      th.th_ta_p = (td_thragent_t *) ta;
+	      th.th_unique = addr;
+	      if (callback (&th, cbdata_p) != 0)
+		return TD_DBERR;
+	    }
 	}
 
       /* Get the pointer to the next element.  */
@@ -135,17 +155,18 @@
      have to iterate over both lists separately.  We start with the
      list of threads with user-defined stacks.  */
 
+  pid_t pid = ps_getpid (ta->ph);
   err = DB_GET_SYMBOL (list, ta, __stack_user);
   if (err == TD_OK)
     err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri,
-			       list, true);
+			       list, true, pid);
 
   /* And the threads with stacks allocated by the implementation.  */
   if (err == TD_OK)
     err = DB_GET_SYMBOL (list, ta, stack_used);
   if (err == TD_OK)
     err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri,
-			       list, false);
+			       list, false, pid);
 
   return err;
 }

Modified: trunk/libc/nptl_db/td_thr_validate.c
==============================================================================
--- trunk/libc/nptl_db/td_thr_validate.c (original)
+++ trunk/libc/nptl_db/td_thr_validate.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,6 @@
 /* Validate a thread handle.
-   Copyright (C) 1999,2001,2002,2003,2004,2007 Free Software Foundation, Inc.
+   Copyright (C) 1999,2001,2002,2003,2004,2007,2008
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1999.
 
@@ -81,5 +82,28 @@
 	err = TD_OK;
     }
 
+  if (err == TD_OK)
+    {
+      /* Verify that this is not a stale element in a fork child.  */
+      pid_t match_pid = ps_getpid (th->th_ta_p->ph);
+      psaddr_t pid;
+      err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique, pthread, pid, 0);
+      if (err == TD_OK && (pid_t) (uintptr_t) pid < 0)
+	{
+	  /* This was a thread that was about to fork, or it is the new sole
+	     thread in a fork child.  In the latter case, its tid was stored
+	     via CLONE_CHILD_SETTID and so is already the proper child PID.  */
+	  if (-(pid_t) (uintptr_t) pid == match_pid)
+	    /* It is about to do a fork, but is really still the parent PID.  */
+	    pid = (psaddr_t) (uintptr_t) match_pid;
+	  else
+	    /* It must be a fork child, whose new PID is in the tid field.  */
+	    err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique,
+				pthread, tid, 0);
+	}
+      if (err == TD_OK && (pid_t) (uintptr_t) pid != match_pid)
+	err = TD_NOTHR;
+    }
+
   return err;
 }

Modified: trunk/libc/nscd/connections.c
==============================================================================
--- trunk/libc/nscd/connections.c (original)
+++ trunk/libc/nscd/connections.c Thu Mar 27 06:22:15 2008
@@ -1,6 +1,5 @@
 /* Inner loops of cache daemon.
-   Copyright (C) 1998-2003, 2004, 2005, 2006, 2007, 2008
-   Free Software Foundation, Inc.
+   Copyright (C) 1998-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -112,7 +111,8 @@
     .propagate = 1,
     .shared = 0,
     .max_db_size = DEFAULT_MAX_DB_SIZE,
-    .reset_res = 0,
+    .suggested_module = DEFAULT_SUGGESTED_MODULE,
+   .reset_res = 0,
     .filename = "/etc/passwd",
     .db_filename = _PATH_NSCD_PASSWD_DB,
     .disabled_iov = &pwd_iov_disabled,
@@ -131,6 +131,7 @@
     .propagate = 1,
     .shared = 0,
     .max_db_size = DEFAULT_MAX_DB_SIZE,
+    .suggested_module = DEFAULT_SUGGESTED_MODULE,
     .reset_res = 0,
     .filename = "/etc/group",
     .db_filename = _PATH_NSCD_GROUP_DB,
@@ -150,6 +151,7 @@
     .propagate = 0,		/* Not used.  */
     .shared = 0,
     .max_db_size = DEFAULT_MAX_DB_SIZE,
+    .suggested_module = DEFAULT_SUGGESTED_MODULE,
     .reset_res = 1,
     .filename = "/etc/hosts",
     .db_filename = _PATH_NSCD_HOSTS_DB,
@@ -169,6 +171,7 @@
     .propagate = 0,		/* Not used.  */
     .shared = 0,
     .max_db_size = DEFAULT_MAX_DB_SIZE,
+    .suggested_module = DEFAULT_SUGGESTED_MODULE,
     .reset_res = 0,
     .filename = "/etc/services",
     .db_filename = _PATH_NSCD_SERVICES_DB,
@@ -346,7 +349,7 @@
   struct database_pers_head head_copy = *head;
 
   /* Check that the header that was read matches the head in the database.  */
-  if (readhead != NULL && memcmp (head, readhead, sizeof (*head)) != 0)
+  if (memcmp (head, readhead, sizeof (*head)) != 0)
     return 0;
 
   /* First some easy tests: make sure the database header is sane.  */
@@ -356,6 +359,7 @@
 	 This should cover daylight saving time changes.  */
       || head->timestamp > now + 60 * 60 + 60
       || (head->gc_cycle & 1)
+      || head->module == 0
       || (size_t) head->module > INT32_MAX / sizeof (ref_t)
       || (size_t) head->data_size > INT32_MAX - head->module * sizeof (ref_t)
       || head->first_free < 0
@@ -506,6 +510,7 @@
 	    int fd = open (dbs[cnt].db_filename, O_RDWR | EXTRA_O_FLAGS);
 	    if (fd != -1)
 	      {
+		char *msg = NULL;
 		struct stat64 st;
 		void *mem;
 		size_t total;
@@ -514,23 +519,26 @@
 						      sizeof (head)));
 		if (n != sizeof (head) || fstat64 (fd, &st) != 0)
 		  {
+		  fail_db_errno:
+		    /* The code is single-threaded at this point so
+		       using strerror is just fine.  */
+		    msg = strerror (errno);
 		  fail_db:
 		    dbg_log (_("invalid persistent database file \"%s\": %s"),
-			     dbs[cnt].db_filename, strerror (errno));
+			     dbs[cnt].db_filename, msg);
 		    unlink (dbs[cnt].db_filename);
 		  }
 		else if (head.module == 0 && head.data_size == 0)
 		  {
-		    /* The file has been created, but the head has not been
-		       initialized yet.  Remove the old file.  */
-		    unlink (dbs[cnt].db_filename);
+		    /* The file has been created, but the head has not
+		       been initialized yet.  */
+		    msg = _("uninitialized header");
+		    goto fail_db;
 		  }
 		else if (head.header_size != (int) sizeof (head))
 		  {
-		    dbg_log (_("invalid persistent database file \"%s\": %s"),
-			     dbs[cnt].db_filename,
-			     _("header size does not match"));
-		    unlink (dbs[cnt].db_filename);
+		    msg = _("header size does not match");
+		    goto fail_db;
 		  }
 		else if ((total = (sizeof (head)
 				   + roundup (head.module * sizeof (ref_t),
@@ -539,10 +547,8 @@
 			 > st.st_size
 			 || total < sizeof (head))
 		  {
-		    dbg_log (_("invalid persistent database file \"%s\": %s"),
-			     dbs[cnt].db_filename,
-			     _("file size does not match"));
-		    unlink (dbs[cnt].db_filename);
+		    msg = _("file size does not match");
+		    goto fail_db;
 		  }
 		/* Note we map with the maximum size allowed for the
 		   database.  This is likely much larger than the
@@ -554,14 +560,12 @@
 				      PROT_READ | PROT_WRITE,
 				      MAP_SHARED, fd, 0))
 			 == MAP_FAILED)
-		  goto fail_db;
+		  goto fail_db_errno;
 		else if (!verify_persistent_db (mem, &head, cnt))
 		  {
 		    munmap (mem, total);
-		    dbg_log (_("invalid persistent database file \"%s\": %s"),
-			     dbs[cnt].db_filename,
-			     _("verification failed"));
-		    unlink (dbs[cnt].db_filename);
+		    msg = _("verification failed");
+		    goto fail_db;
 		  }
 		else
 		  {

Modified: trunk/libc/nscd/nscd.h
==============================================================================
--- trunk/libc/nscd/nscd.h (original)
+++ trunk/libc/nscd/nscd.h Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007
+/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxx>, 1998.
@@ -119,6 +119,9 @@
 
 /* Number of bytes of data we initially reserve for each hash table bucket.  */
 #define DEFAULT_DATASIZE_PER_BUCKET 1024
+
+/* Default module of hash table.  */
+#define DEFAULT_SUGGESTED_MODULE 211
 
 
 /* Number of seconds between two cache pruning runs if we do not have

Modified: trunk/libc/nscd/nscd_conf.c
==============================================================================
--- trunk/libc/nscd/nscd_conf.c (original)
+++ trunk/libc/nscd/nscd_conf.c Thu Mar 27 06:22:15 2008
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2000, 2003-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2003-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxx>, 1998.
 
@@ -140,7 +140,8 @@
 	{
 	  int idx = find_db (arg1);
 	  if (idx >= 0)
-	    dbs[idx].suggested_module = atol (arg2);
+	    dbs[idx].suggested_module
+	      = atol (arg2) ?: DEFAULT_SUGGESTED_MODULE;
 	}
       else if (strcmp (entry, "enable-cache") == 0)
 	{
@@ -168,7 +169,7 @@
 	{
 	  int idx = find_db (arg1);
 	  if (idx >= 0)
-	    dbs[idx].max_db_size = atol (arg2);
+	    dbs[idx].max_db_size = atol (arg2) ?: DEFAULT_MAX_DB_SIZE;
 	}
       else if (strcmp (entry, "logfile") == 0)
 	set_logfile (arg1);

Modified: trunk/libc/nscd/nscd_helper.c
==============================================================================
--- trunk/libc/nscd/nscd_helper.c (original)
+++ trunk/libc/nscd/nscd_helper.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,4 @@
-/* Copyright (C) 1998-2002,2003,2004,2005,2006,2007
-   Free Software Foundation, Inc.
+/* Copyright (C) 1998-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -339,6 +338,9 @@
 
       if (__builtin_expect (head->version != DB_VERSION, 0)
 	  || __builtin_expect (head->header_size != sizeof (*head), 0)
+	  /* Catch some misconfiguration.  The server should catch
+	     them now but some older versions did not.  */
+	  || __builtin_expect (head->module == 0, 0)
 	  /* This really should not happen but who knows, maybe the update
 	     thread got stuck.  */
 	  || __builtin_expect (! head->nscd_certainly_running

Modified: trunk/libc/nss/nss_files/files-XXX.c
==============================================================================
--- trunk/libc/nss/nss_files/files-XXX.c (original)
+++ trunk/libc/nss/nss_files/files-XXX.c Thu Mar 27 06:22:15 2008
@@ -1,5 +1,6 @@
 /* Common code for file-based databases in nss_files module.
-   Copyright (C) 1996-1999,2001,2002,2004,2007 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2001,2002,2004,2007,2008
+   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
@@ -254,7 +255,11 @@
   /* Be prepared that the set*ent function was not called before.  */

[... 16133 lines stripped ...]