about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-07-18 04:41:16 +0000
committerRoland McGrath <roland@gnu.org>2005-07-18 04:41:16 +0000
commit7a85da437bd49afd827c41474677c3904cf7ce3e (patch)
tree8ab56107960fcc0f3a2cf39f2eef07aadc180e1a
parentefe36102b1d423e82e94217e069460134cde5687 (diff)
downloadglibc-7a85da437bd49afd827c41474677c3904cf7ce3e.tar.gz
glibc-7a85da437bd49afd827c41474677c3904cf7ce3e.tar.xz
glibc-7a85da437bd49afd827c41474677c3904cf7ce3e.zip
Updated to fedora-glibc-2_3-20050718T0425
-rw-r--r--ChangeLog352
-rw-r--r--config.h.in3
-rw-r--r--config.make.in1
-rw-r--r--configure.in8
-rw-r--r--debug/chk_fail.c7
-rw-r--r--elf/Makefile11
-rw-r--r--elf/dl-close.c54
-rw-r--r--elf/unload6.c30
-rw-r--r--elf/unload6mod1.c16
-rw-r--r--elf/unload6mod2.c23
-rw-r--r--elf/unload6mod3.c23
-rw-r--r--fedora/branch.mk4
-rw-r--r--grp/putgrent.c9
-rw-r--r--hesiod/README.hesiod8
-rw-r--r--hesiod/hesiod.c57
-rw-r--r--hesiod/hesiod_p.h1
-rw-r--r--iconvdata/ibm930.h2
-rw-r--r--iconvdata/ibm939.c18
-rw-r--r--iconvdata/ibm939.h2
-rw-r--r--iconvdata/testdata/IBM930..UTF8bin48136 -> 48138 bytes
-rw-r--r--iconvdata/testdata/IBM939..UTF8bin48136 -> 48138 bytes
-rw-r--r--include/rpc/pmap_clnt.h4
-rw-r--r--include/stdlib.h4
-rw-r--r--include/string.h1
-rw-r--r--io/sys/sendfile.h6
-rw-r--r--locale/iso-4217.def1
-rw-r--r--localedata/ChangeLog40
-rw-r--r--localedata/SUPPORTED21
-rw-r--r--localedata/locales/fa_IR211
-rw-r--r--localedata/locales/mn_MN139
-rw-r--r--localedata/locales/pa_IN8
-rw-r--r--localedata/locales/sr_CS349
-rw-r--r--malloc/Makefile2
-rw-r--r--malloc/malloc.c2
-rw-r--r--manual/string.texi2
-rw-r--r--nis/nis_removemember.c10
-rw-r--r--nis/nis_table.c5
-rw-r--r--nis/nss_compat/compat-grp.c15
-rw-r--r--nis/nss_compat/compat-pwd.c16
-rw-r--r--nis/nss_compat/compat-spwd.c16
-rw-r--r--nptl/ChangeLog38
-rw-r--r--nptl/Makefile3
-rw-r--r--nptl/pthread_create.c10
-rw-r--r--nptl/sysdeps/pthread/bits/libc-lock.h2
-rw-r--r--nptl/sysdeps/pthread/pthread.h29
-rw-r--r--nptl/tst-cancel17.c2
-rw-r--r--nptl/tst-initializers1.c48
-rw-r--r--nscd/Makefile6
-rw-r--r--nscd/connections.c8
-rw-r--r--nscd/nscd_helper.c5
-rw-r--r--nscd/nscd_stat.c4
-rw-r--r--nscd/selinux.c43
-rw-r--r--posix/fnmatch.c79
-rw-r--r--posix/regcomp.c2
-rw-r--r--posix/regex_internal.c6
-rw-r--r--posix/regex_internal.h9
-rw-r--r--posix/regexec.c14
-rw-r--r--pwd/putpwent.c24
-rw-r--r--stdio-common/vfscanf.c17
-rw-r--r--stdlib/random_r.c29
-rw-r--r--stdlib/stdlib.h2
-rw-r--r--string/Makefile2
-rw-r--r--string/tst-strfry.c15
-rw-r--r--sunrpc/Makefile27
-rw-r--r--sunrpc/bindrsvprt.c23
-rw-r--r--sunrpc/pm_getmaps.c15
-rw-r--r--sunrpc/pm_getport.c52
-rw-r--r--sunrpc/pmap_rmt.c3
-rw-r--r--sunrpc/rpc_main.c6
-rw-r--r--sunrpc/tst-xdrmem.c205
-rw-r--r--sunrpc/xdr.c4
-rw-r--r--sunrpc/xdr_stdio.c12
-rw-r--r--sysdeps/generic/strnlen.c1
-rw-r--r--sysdeps/ia64/strlen.S4
-rw-r--r--sysdeps/posix/posix_fallocate.c43
-rw-r--r--sysdeps/posix/posix_fallocate64.c47
-rw-r--r--sysdeps/posix/sigignore.c2
-rw-r--r--sysdeps/posix/signal.c1
-rw-r--r--sysdeps/posix/sigset.c1
-rw-r--r--sysdeps/posix/sysv_signal.c2
-rw-r--r--sysdeps/s390/s390-64/bcopy.S12
-rw-r--r--sysdeps/unix/sysv/linux/dl-execstack.c24
-rw-r--r--sysdeps/unix/sysv/linux/ia64/has_cpuclock.c10
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c9
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c166
-rw-r--r--sysdeps/unix/sysv/linux/netlinkaccess.h3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c6
-rw-r--r--sysdeps/unix/sysv/linux/sleep.c1
-rw-r--r--sysdeps/unix/sysv/linux/sys/quota.h89
-rw-r--r--sysdeps/unix/sysv/linux/sysctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/system.c1
-rw-r--r--time/Makefile2
-rw-r--r--time/mktime.c3
-rw-r--r--time/strptime_l.c36
-rw-r--r--time/tst-strptime2.c59
96 files changed, 2354 insertions, 402 deletions
diff --git a/ChangeLog b/ChangeLog
index 755fcd6965..d215767101 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,261 @@
+2005-07-15  Andreas Jaeger  <aj@suse.de>
+
+	[BZ #1079]
+	* include/stdlib.h: Remove malloc attribute from __posix_memalign.
+	* stdlib/stdlib.h: Likewise.
+
+2005-07-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* nscd/nscd_helper.c: Add a few __builtin_expect.
+
+	[BZ #1080]
+	* nscd/connections.c (send_ro_fd): Make sure BUF is aligned correctly.
+	* nscd/nscd_helper.c (wait_on_socket): New function.
+	(get_mapping): Use wait_on_socket instead of poll.  The former handles
+	EINTR of poll correctly.
+	(__nscd_open_socket): Likewise.
+	(get_mapping): Make sure BUF is aligned correctly.
+	(get_mapping): Use munmap on correct pointer.
+
+2005-07-12  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1106]
+	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c: Include not-cancel.h.
+	(has_cpuclock): Use open_not_cancel_2 instead of open, read_not_cancel
+	instead of read and close_not_cancel_no_status instead of close.
+
+	[BZ #1106]
+	* sysdeps/s390/s390-64/bcopy.S (__bcopy): Use
+	HIDDEN_BUILTIN_JUMPTARGET to jump to memmove.
+
+2005-07-05  Thorsten Kukuk  <kukuk@suse.de>
+
+	[BZ #1111]
+	* nis/nss_compat/compat-grp.c (internal_getgrgid_r): Check if NSS
+	module provides getgrgid_r.
+	(getgrnam_plusgroup): Preserve original return value.
+	* nis/nss_compat/compat-pwd.c (getpwnam_plususer): Preserve
+	original return value.
+	* nis/nss_compat/compat-spwd.c (getspnam_plususer): Likewise.
+
+2005-07-05  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1101]
+	* posix/regex_internal.c (build_wcs_buffer): Use MB_LEN_MAX not
+	MB_CUR_MAX.
+	(build_wcs_upper_buffer): Likewise.
+
+2005-06-16  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1016]
+	* sysdeps/ia64/strlen.S (strlen): Change l2 into a local label.
+
+2005-06-23  Thorsten Kukuk  <kukuk@suse.de>
+
+	[BZ #1109]
+	* nscd/nscd_stat.c (receive_print_stats): Replace YESSTR/NOSTR
+	with own translation.
+
+2005-06-25  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1097]
+	* sunrpc/xdr.c (xdr_hyper, xdr_u_hyper): When decoding, cast
+	t2 to uint32_t instead of ulong.
+	* sunrpc/Makefile (tests): Add tst-xdrmem.
+	* sunrpc/tst-xdrmem.c: New test.
+
+2005-06-20  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #653]
+	* sysdeps/unix/sysv/linux/sys/quota.h: Add definitions and types for
+	_LINUX_QUOTA_VERSION >= 2.
+	(_LINUX_QUOTA_VERSION): Define if not yet defined.
+
+2005-06-17  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1106]
+	* time/mktime.c: Always include <string.h> for prototype of
+	implicitly used memcpy.
+
+	[BZ #1104]
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
+	(truncate64): Use __truncate, not truncate.
+	(__have_no_truncate64): Renamed from have_no_truncate64.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
+	(__have_no_truncate64): Renamed from have_no_truncate64.
+
+2005-06-17  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1106]
+	* sysdeps/posix/sigignore.c: Include <string.h> to tell the compiler
+	to use __GI_memset.
+	* sysdeps/posix/signal.c: Likewise.
+	* sysdeps/posix/sigset.c: Likewise.
+	* sysdeps/posix/sysv_signal.c: Likewise.
+	* sysdeps/unix/sysv/linux/sleep.c: Likewise.
+	* sysdeps/unix/sysv/linux/sysctl.c: Likewise.
+	* sysdeps/unix/sysv/linux/system.c: Likewise.
+
+2005-06-15  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1088]
+	* hesiod/hesiod.c (hesiod_init): Don't check for ctx->classes[0] == 0
+	or both classes equal here.
+	(parse_config_file): If both classes are equal, clear the second one.
+
+2005-06-08  Karl Kelley  <kekelley@iastate.edu>
+
+	[BZ #1088]
+	* hesiod/hesiod_p.h (struct hesiod_p): Add classes array.
+	* hesiod/hesiod.c (hesiod_init): Initialize classes.  Fail if no
+	valid classes were given or if both are equal.
+	(hesiod_resolve): Use ctx->classes instead of hardcoded C_IN
+	and C_HS order.
+	(parse_config_file): Handle classes keyword.
+	* hesiod/README.hesiod: Mention addition of the classes keyword.
+
+2005-06-14  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1085]
+	* configure.in: Add test for availability of libaudit.
+	* config.h.in: Define HAVE_LIBAUDIT.
+	* config.make.in: Define have-libaudit.
+	* nscd/Makefile: If libaudit is available, link nscd with it.
+	* nscd/selinux.c: If HAVE_LIBAUDIT is defined, log using libaudit.
+	Patch by Steve Grubb <sgrubb@redhat.com>.
+
+	[BZ #1083]
+	* sysdeps/posix/posix_fallocate64.c: Use __libc_pread64 instead of
+	__pread64.
+
+	[BZ #1087]
+	* include/string.h: Use libc_hidden_proto for strnlen.
+	* sysdeps/generic/strnlen.c: Add libc_hidden_def.
+
+2005-06-13  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1096]
+	* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_sendreq,
+	__netlink_receive): Remove prototypes.
+	(__netlink_request): New prototype.
+	* sysdeps/unix/sysv/linux/ifaddrs.c: Include <alloca.h> and
+	<stdint.h>.
+	(__netlink_sendreq): Make static.
+	(__netlink_receive): Rename to...
+	(__netlink_request): ... this.  Add type argument, call
+	__netlink_sendreq.  If MSG_TRUNC is set after recvmsg, retry
+	with a bigger buffer.  Don't record buffers that contain no
+	messages we are expecting.
+	(getifaddrs): Use __netlink_request instead of __netlink_sendreq
+	and __netlink_receive pairs.  Formatting.
+	* sysdeps/unix/sysv/linux/if_index.c (if_nameindex_netlink): Use
+	__netlink_request instead of __netlink_sendreq and __netlink_receive
+	pair.
+
+2005-05-23  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1086]
+	* sunrpc/bindrsvprt.c (LOWPORT): Apparently some mountd
+	implementations are broken and don't accept ports < 512.
+
+2005-05-22  Dmitry V. Levin  <ldv@altlinux.org>
+
+	[BZ #961]
+	* io/sys/sendfile.h: Remove __nonnull from sendfile and sendfile64
+	declarations.
+
+2005-05-23  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1086]
+	* sunrpc/pm_getport.c (__get_socket): New function.
+	(pmap_getport): Use it to open a non-reserved socket to the portmapper
+	for TCP.
+	* include/rpc/pmap_clnt.h (__get_socket): Declare.
+	* sunrpc/pm_getmaps.c (pmap_getmaps): Use __get_socket to get an
+	non-reserved socket for the portmapper.
+	Based on a patch by Steve Dickson <steved@redhat.com>.
+
+	[BZ #1086]
+	* sunrpc/bindrsvprt.c (bindresvport): Try harder to find a port.
+	If we tried looking at the usual range without success extend the
+	range to even lower ports.
+
+2005-05-19  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #955]
+	* iconvdata/ibm939.c (BODY): Avoid segfaults with input characters
+	<UFFFF> and above.
+
+2005-05-06  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #934]
+	* posix/regex_internal.h: Include bits/libc-lock.h or define dummy
+	__libc_lock_* macros if not _LIBC.
+	(struct re_dfa_t): Add lock.
+	* posix/regcomp.c (re_compile_internal): Add __libc_lock_init.
+	* posix/regexec.c (regexec, re_search_stub): Add locking.
+
+2005-04-29  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1083]
+	* sysdeps/posix/posix_fallocate.c (posix_fallocate): If len == 0,
+	call ftruncate if offset is bigger than current size.  Make sure
+	the file is offset + len bytes long if that is more than current size.
+	Don't overwrite previous content of the file.
+	* sysdeps/posix/posix_fallocate64.c (__posix_fallocate64_l64):
+	Likewise.
+
+2005-04-29  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1093]
+	* nis/nis_table.c: Fix realloc handling.
+	* nis/nis_removemember.c: Likewise.
+
+2005-04-27  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1094]
+	* nscd/connections.c (nscd_run): Use time() value in prune_cache
+	call, not timeout value, since the latter might be from another clock.
+
 2005-04-27  Roland McGrath  <roland@redhat.com>
 
 	[BZ #877]
 	* posix/unistd.h: Remove __nonnull from acct decl.
 
+2005-04-26  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1105]
+	* time/strptime_l.c (__strptime_internal): Handle 'z' to set
+	tm_gmtoff.
+	* time/Makefile (tests): Add tst-strptime2.
+	* time/tst-strptime2.c: New file.
+
+2005-04-26  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1081]
+	* elf/dl-close.c: Include stddef.h.
+	(_dl_close): If called recursively, just remember GC needs to be rerun
+	and decrease l_direct_opencount.  Avoid GC if l_direct_opencount
+	decreased to 1.  Rerun GC at the end if any destructor unloaded some
+	additional libraries.
+	* elf/Makefile: Add rules to build and run unload6 test.
+	* elf/unload6.c: New test.
+	* elf/unload6mod1.c: New file.
+	* elf/unload6mod2.c: New file.
+	* elf/unload6mod3.c: New file.
+
+2005-04-26  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1110]
+	* stdio-common/vfscanf.c: Correctly account for characters of
+	decimal points right after +-.
+
+2005-04-24  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1110]
+	* stdio-common/vfscanf.c: Fix parsing of decimal point after +-.
+	Patch by Hamed Malek <hamed@bamdad.org>.
+
 2005-04-14  Roland McGrath  <roland@redhat.com>
 
 	[BZ #253]
@@ -27,10 +280,109 @@
 	* posix/Makefile: Add rules to build and run tst-execvp3.
 	* posix/tst-execvp3.c: New file.
 
+2005-04-12  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1090]
+	* stdlib/random_r.c (__initstate_r): Don't use non-existing state.
+	* string/tst-strfry.c: New file.
+	* string/Makefile (tests): Add tst-strfry.
+
+2005-04-11  James A. Morrison  <ja2morri@uwaterloo.ca>
+
+	* manual/string.texi: Fix typo in wmemcpy decl.
+
 2005-04-07  Roland McGrath  <roland@redhat.com>
 
 	* po/libc.pot: Regenerated.
 
+2005-04-04  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1082]
+	* sunrpc/pmap_rmt.c (xdr_rmtcall_args): Use a dummy arglen instead
+	of trying to encode uninitialized arglen.
+
+2005-03-29  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1087]
+	* posix/fnmatch.c (fnmatch): For short patterns or strings attempt to
+	avoid calling mbsrtowcs twice.
+
+2005-02-27  Denis Barbier  <barbier@debian.org>
+
+	[BZ #549]
+	* locale/iso-4217.def: Add CSD currency.
+
+2005-03-21  Thorsten Kukuk  <kukuk@suse.de>
+
+	[BZ #1098]
+	* sunrpc/xdr_stdio.c (xdrstdio_getlong, xdrstdio_putlong):
+	Convert correctly between long/int on 64bit big-endian.
+
+2005-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #779]
+	* malloc/malloc.c (public_mTRIm): Initialize malloc if not yet
+	initialized.
+
+2005-03-05  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1101]
+	* posix/regex_internal.c [_LIBC] (build_wcs_buffer): Avoid using
+	dynamically sized array.
+	(build_wcs_upper_buffer): Likewise.
+
+2005-02-22  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1095]
+	* malloc/Makefile (CFLAGS-mcheck-init.c): Add.
+	* sunrpc/Makefile: Add $(PIC-ccflag) to CFLAGS-x* for
+	librpcsvc.a objects.
+
+2005-02-21  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1107]
+	* iconvdata/ibm930.h: Correct Yen mapping.
+	* iconvdata/ibm939.h: Likewise.
+	* iconvdata/testdata/IBM930..UTF8: Adjust test data.
+	* iconvdata/testdata/IBM939..UTF8: Likewise.
+	Patch by Jiro Sekiba <SEKIBA@jp.ibm.com>.
+
+2005-02-11  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1100]
+	* debug/chk_fail.c (__chk_fail): Add a while (1) loop around
+	__libc_message to kill GCC warning about noreturn function returning.
+
+2005-02-07  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/dl-execstack.c: Include sysdep.h.
+	(_dl_make_stack_executable): Make sure registers are set correctly.
+
+2005-01-30  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1103]
+	* nscd/nscd_helper.c (get_mapping): Use MSG_NOSIGNAL if available.
+	* nscd/connections.c (send_ro_fd): Likewise.
+
+2005-01-26  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1100]
+	* debug/chk_fail.c (__chk_fail): Print program name in final message.
+
+2005-01-14  GOTO Masanori  <gotom@debian.or.jp>
+
+	[BZ #1108]
+	* sunrpc/rpc_main.c (s_output): Generate #include <rpc/pmap_clnt.h>
+	irrespective of Cflag.
+
+2005-01-11  Thorsten Kukuk  <kukuk@suse.de>
+
+	[BZ #1099]
+	* grp/putgrent.c (putgrent): Don't write 0 as group
+	ID if groupname starts with + or -.
+	* pwd/putpwent.c (putpwent): Don't write 0 as user or
+	group ID if user name starts with + or -.
+
 2005-04-05  Roland McGrath  <roland@redhat.com>
 
 	* NEWS, version.h (VERSION): 2.3.5.
diff --git a/config.h.in b/config.h.in
index db3defc6b0..5406d41111 100644
--- a/config.h.in
+++ b/config.h.in
@@ -21,6 +21,9 @@
 /* Define if building with SELinux support.  Set by --with-selinux.  */
 #undef	HAVE_SELINUX
 
+/* Defined if building with SELinux support & audit libs are detected. */
+#undef	HAVE_LIBAUDIT
+
 /* Define if using XCOFF. Set by --with-xcoff.  */
 #undef	HAVE_XCOFF
 
diff --git a/config.make.in b/config.make.in
index 81cb95b77f..222fb33bd3 100644
--- a/config.make.in
+++ b/config.make.in
@@ -59,6 +59,7 @@ enable-check-abi = @enable_check_abi@
 have-forced-unwind = @libc_cv_forced_unwind@
 have-fpie = @libc_cv_fpie@
 have-selinux = @have_selinux@
+have-libaudit = @have_libaudit@
 have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
 fno-unit-at-a-time = @fno_unit_at_a_time@
 bind-now = @bindnow@
diff --git a/configure.in b/configure.in
index 559bee0173..ab4975e481 100644
--- a/configure.in
+++ b/configure.in
@@ -1965,6 +1965,14 @@ fi
 # Check if we're building with SELinux support.
 if test "x$have_selinux" = xyes; then
   AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
+
+  # See if we have the libaudit library
+  AC_CHECK_LIB(audit, audit_log_avc,
+              have_libaudit=yes, have_libaudit=no)
+  if test "x$have_libaudit" = xyes; then
+    AC_DEFINE(HAVE_LIBAUDIT,1,[SELinux libaudit support])
+  fi
+  AC_SUBST(have_libaudit)
 fi
 AC_SUBST(have_selinux)
 
diff --git a/debug/chk_fail.c b/debug/chk_fail.c
index dc1c3d70b6..987331bd9d 100644
--- a/debug/chk_fail.c
+++ b/debug/chk_fail.c
@@ -21,10 +21,15 @@
 #include <stdlib.h>
 
 
+extern char **__libc_argv attribute_hidden;
+
 void
 __attribute__ ((noreturn))
 __chk_fail (void)
 {
-  __libc_fatal ("*** buffer overflow detected ***\n");
+  /* The loop is added only to keep gcc happy.  */
+  while (1)
+    __libc_message (1, "*** buffer overflow detected ***: %s terminated\n",
+		    __libc_argv[0] ?: "<unknown>");
 }
 libc_hidden_def (__chk_fail)
diff --git a/elf/Makefile b/elf/Makefile
index 04ff7f42a1..72aa0d9572 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -86,6 +86,7 @@ distribute	:= rtld-Rules \
 		   tst-deep1mod1.c tst-deep1mod2.c tst-deep1mod3.c \
 		   unload3mod1.c unload3mod2.c unload3mod3.c unload3mod4.c \
 		   unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
+		   unload6mod1.c unload6mod2.c unload6mod3.c \
 		   order2mod1.c order2mod2.c order2mod3.c order2mod4.c
 
 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
@@ -158,7 +159,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
 	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \
 	 tst-align2 $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
 	 tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
-	 unload3 unload4 unload5 tst-global1 order2
+	 unload3 unload4 unload5 unload6 tst-global1 order2
 #	 reldep9
 test-srcs = tst-pathopt
 tests-vis-yes = vismain
@@ -196,6 +197,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		tst-dlmopen1mod \
 		unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
 		unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
+		unload6mod1 unload6mod2 unload6mod3 \
 		order2mod1 order2mod2 order2mod3 order2mod4
 ifeq (yes,$(have-initfini-array))
 modules-names += tst-array2dep
@@ -433,6 +435,9 @@ $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
+$(objpfx)unload6mod1.so: $(libdl)
+$(objpfx)unload6mod2.so: $(libdl)
+$(objpfx)unload6mod3.so: $(libdl)
 
 LDFLAGS-tst-tlsmod5.so = -nostdlib
 LDFLAGS-tst-tlsmod6.so = -nostdlib
@@ -701,6 +706,10 @@ $(objpfx)unload5: $(libdl)
 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
 		      $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
 
+$(objpfx)unload6: $(libdl)
+$(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
+		      $(objpfx)unload6mod3.so
+
 ifdef libdl
 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
diff --git a/elf/dl-close.c b/elf/dl-close.c
index df4f5aed87..f54cc03286 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -20,6 +20,7 @@
 #include <assert.h>
 #include <dlfcn.h>
 #include <libintl.h>
+#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -105,9 +106,6 @@ _dl_close (void *_map)
   struct link_map *map = _map;
   unsigned int i;
   Lmid_t ns = map->l_ns;
-#ifdef USE_TLS
-  bool any_tls = false;
-#endif
 
   /* First see whether we can remove the object at all.  */
   if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0)
@@ -124,9 +122,17 @@ _dl_close (void *_map)
   /* One less direct use.  */
   --map->l_direct_opencount;
 
-  /* Decrement the reference count.  */
-  if (map->l_direct_opencount > 1 || map->l_type != lt_loaded)
+  /* If _dl_close is called recursively (some destructor call dlclose),
+     just record that the parent _dl_close will need to do garbage collection
+     again and return.  */
+  static enum { not_pending, pending, rerun } dl_close_state;
+
+  if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
+      || dl_close_state != not_pending)
     {
+      if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
+	dl_close_state = rerun;
+
       /* There are still references to this object.  Do nothing more.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
 	GLRO(dl_debug_printf) ("\nclosing file=%s; direct_opencount == %u\n",
@@ -136,12 +142,18 @@ _dl_close (void *_map)
       return;
     }
 
+ retry:
+  dl_close_state = pending;
+
+#ifdef USE_TLS
+  bool any_tls = false;
+#endif
   const unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
   char used[nloaded];
   char done[nloaded];
   struct link_map *maps[nloaded];
 
-  /* Run over the list and assign indeces to the link maps and enter
+  /* Run over the list and assign indexes to the link maps and enter
      them into the MAPS array.  */
   int idx = 0;
   for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
@@ -278,7 +290,7 @@ _dl_close (void *_map)
 	  if (imap->l_searchlist.r_list == NULL
 	      && imap->l_initfini != NULL)
 	    {
-	      /* The object is still used.  But the object we are
+	      /* The object is still used.  But one of the objects we are
 		 unloading right now is responsible for loading it.  If
 		 the current object does not have it's own scope yet we
 		 have to create one.  This has to be done before running
@@ -294,15 +306,27 @@ _dl_close (void *_map)
 	      imap->l_searchlist.r_nlist = cnt;
 
 	      for (cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
-		if (imap->l_scope[cnt] == &map->l_searchlist)
+		/* This relies on l_scope[] entries being always set either
+		   to its own l_symbolic_searchlist address, or some other map's
+		   l_searchlist address.  */
+		if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
 		  {
-		    imap->l_scope[cnt] = &imap->l_searchlist;
-		    break;
+		    struct link_map *tmap;
+
+		    tmap = (struct link_map *) ((char *) imap->l_scope[cnt]
+						- offsetof (struct link_map,
+							    l_searchlist));
+		    assert (tmap->l_ns == ns);
+		    if (tmap->l_idx != -1)
+		      {
+			imap->l_scope[cnt] = &imap->l_searchlist;
+			break;
+		      }
 		  }
 	    }
 
 	  /* The loader is gone, so mark the object as not having one.
-	     Note: l_idx == -1 -> object will be removed.  */
+	     Note: l_idx != -1 -> object will be removed.  */
 	  if (imap->l_loader != NULL && imap->l_loader->l_idx != -1)
 	    imap->l_loader = NULL;
 
@@ -514,8 +538,12 @@ _dl_close (void *_map)
   _r_debug.r_state = RT_CONSISTENT;
   GLRO(dl_debug_state) ();
 
-  /* Release the lock.  */
+  /* Recheck if we need to retry, release the lock.  */
  out:
+  if (dl_close_state == rerun)
+    goto retry;
+
+  dl_close_state = not_pending;
   __rtld_lock_unlock_recursive (GL(dl_load_lock));
 }
 libc_hidden_def (_dl_close)
@@ -586,7 +614,7 @@ libc_freeres_fn (free_mem)
 	free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
       else
 # endif
-        /* The first element of the list does not have to be deallocated.
+	/* The first element of the list does not have to be deallocated.
 	   It was allocated in the dynamic linker (i.e., with a different
 	   malloc), and in the static library it's in .bss space.  */
 	free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
diff --git a/elf/unload6.c b/elf/unload6.c
new file mode 100644
index 0000000000..1efc7eb841
--- /dev/null
+++ b/elf/unload6.c
@@ -0,0 +1,30 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+  void *h = dlopen ("unload6mod1.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen unload6mod1.so failed");
+      return 1;
+    }
+
+  int (*fn) (int);
+  fn = dlsym (h, "foo");
+  if (fn == NULL)
+    {
+      puts ("dlsym failed");
+      return 1;
+    }
+
+  int val = fn (16);
+  if (val != 24)
+    {
+      printf ("foo returned %d != 24\n", val);
+      return 1;
+    }
+
+  return 0;
+}
diff --git a/elf/unload6mod1.c b/elf/unload6mod1.c
new file mode 100644
index 0000000000..24f2e5a19a
--- /dev/null
+++ b/elf/unload6mod1.c
@@ -0,0 +1,16 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+foo (int i)
+{
+  void *h = dlopen ("unload6mod2.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen unload6mod2.so failed");
+      return 1;
+    }
+
+  dlclose (h);
+  return i + 8;
+}
diff --git a/elf/unload6mod2.c b/elf/unload6mod2.c
new file mode 100644
index 0000000000..980efa4b0e
--- /dev/null
+++ b/elf/unload6mod2.c
@@ -0,0 +1,23 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static void *h;
+
+static void __attribute__((constructor))
+mod2init (void)
+{
+  h = dlopen ("unload6mod3.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen unload6mod3.so failed");
+      fflush (stdout);
+      _exit (1);
+    }
+}
+
+static void __attribute__((destructor))
+mod2fini (void)
+{
+  dlclose (h);
+}
diff --git a/elf/unload6mod3.c b/elf/unload6mod3.c
new file mode 100644
index 0000000000..7b29e1d626
--- /dev/null
+++ b/elf/unload6mod3.c
@@ -0,0 +1,23 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static void *h;
+
+static void __attribute__((constructor))
+mod3init (void)
+{
+  h = dlopen ("unload6mod1.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen unload6mod1.so failed");
+      fflush (stdout);
+      _exit (1);
+    }
+}
+
+static void __attribute__((destructor))
+mod3fini (void)
+{
+  dlclose (h);
+}
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 5c9f791034..4e83198b67 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora-2_3
 glibc-base := glibc-2_3-branch
 DIST_BRANCH := FC-3
 COLLECTION := dist-fc3-updates-candidate
-fedora-2_3-sync-date := 2005-07-04 11:33 UTC
-fedora-2_3-sync-tag := fedora-glibc-2_3-20050704T1133
+fedora-2_3-sync-date := 2005-07-18 04:25 UTC
+fedora-2_3-sync-tag := fedora-glibc-2_3-20050718T0425
diff --git a/grp/putgrent.c b/grp/putgrent.c
index cb9b6b1f79..8280b0cb2f 100644
--- a/grp/putgrent.c
+++ b/grp/putgrent.c
@@ -44,8 +44,13 @@ putgrent (gr, stream)
 
   flockfile (stream);
 
-  retval = fprintf (stream, "%s:%s:%u:",
-		    gr->gr_name, _S (gr->gr_passwd), gr->gr_gid);
+  if (gr->gr_name[0] == '+' || gr->gr_name[0] == '-')
+    retval = fprintf (stream, "%s:%s::",
+		      gr->gr_name, _S (gr->gr_passwd));
+  else
+    retval = fprintf (stream, "%s:%s:%lu:",
+		      gr->gr_name, _S (gr->gr_passwd),
+		      (unsigned long int) gr->gr_gid);
   if (__builtin_expect (retval, 0) < 0)
     {
       funlockfile (stream);
diff --git a/hesiod/README.hesiod b/hesiod/README.hesiod
index 18cd5d45dd..259ce8d447 100644
--- a/hesiod/README.hesiod
+++ b/hesiod/README.hesiod
@@ -71,6 +71,14 @@ will want to create your own.  It should look something like:
 
   rhs=.your.domain
   lhs=.ns
+  classes=in,hs
+
+The optional classes settings specifies which DNS classes Hesiod
+should do lookups in.  Possible values are IN (the preferred class)
+and  HS (the deprecated class, still used by some sites).
+You may specify both classes separated by a comma to try one class
+first and then the other if no entry is available in the first
+class.  The default value of the classes variable is `IN,HS'.
 
 The value of rhs can be overridden by the environment variable
 `HES_DOMAIN'.
diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
index 7fffb310f1..b73aa3ce94 100644
--- a/hesiod/hesiod.c
+++ b/hesiod/hesiod.c
@@ -83,6 +83,9 @@ hesiod_init(void **context) {
 	ctx->LHS = NULL;
 	ctx->RHS = NULL;
 	ctx->res = NULL;
+	/* Set default query classes. */
+	ctx->classes[0] = C_IN;
+	ctx->classes[1] = C_HS;
 
 	configname = __secure_getenv("HESIOD_CONFIG");
 	if (!configname)
@@ -234,15 +237,12 @@ hesiod_resolve(void *context, const char *name, const char *type) {
 		return (NULL);
 	}
 
-	if ((retvec = get_txt_records(ctx, C_IN, bindname))) {
-		free(bindname);
-		return (retvec);
-	}
+	retvec = get_txt_records(ctx, ctx->classes[0], bindname);
+
+	if (retvec == NULL && (errno == ENOENT || errno == ECONNREFUSED) && ctx->classes[1])
+		retvec = get_txt_records(ctx, ctx->classes[1], bindname);
 
-	if (errno != ENOENT && errno != ECONNREFUSED)
-		return (NULL);
 
-	retvec = get_txt_records(ctx, C_HS, bindname);
 	free(bindname);
 	return (retvec);
 }
@@ -261,7 +261,6 @@ hesiod_free_list(void *context, char **list) {
  */
 static int
 parse_config_file(struct hesiod_p *ctx, const char *filename) {
-	char *key, *data, *cp, **cpp;
 	char buf[MAXDNAME+7];
 	FILE *fp;
 
@@ -272,6 +271,9 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
 	free(ctx->RHS);
 	free(ctx->LHS);
 	ctx->RHS = ctx->LHS = 0;
+	/* Set default query classes. */
+	ctx->classes[0] = C_IN;
+	ctx->classes[1] = C_HS;
 
 	/*
 	 * Now open and parse the file...
@@ -280,6 +282,8 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
 		return (-1);
 
 	while (fgets(buf, sizeof(buf), fp) != NULL) {
+		char *key, *data, *cp, **cpp;
+
 		cp = buf;
 		if (*cp == '#' || *cp == '\n' || *cp == '\r')
 			continue;
@@ -297,17 +301,36 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
 			cp++;
 		*cp++ = '\0';
 
-		if (strcmp(key, "lhs") == 0)
+		cpp = NULL;
+		if (strcasecmp(key, "lhs") == 0)
 			cpp = &ctx->LHS;
-		else if (strcmp(key, "rhs") == 0)
+		else if (strcasecmp(key, "rhs") == 0)
 			cpp = &ctx->RHS;
-		else
-			continue;
-
-		*cpp = malloc(strlen(data) + 1);
-		if (!*cpp)
-			goto cleanup;
-		strcpy(*cpp, data);
+		if (cpp) {
+			*cpp = strdup(data);
+			if (!*cpp)
+				goto cleanup;
+		} else if (strcasecmp(key, "classes") == 0) {
+			int n = 0;
+			while (*data && n < 2) {
+				cp = strchrnul(data, ',');
+				if (*cp != '\0')
+					*cp++ = '\0';
+				if (strcasecmp(data, "IN") == 0)
+					ctx->classes[n++] = C_IN;
+				else if (strcasecmp(data, "HS") == 0)
+					ctx->classes[n++] = C_HS;
+				data = cp;
+			}
+			if (n == 0) {
+				/* Restore the default.  Better than
+				   nother at all.  */
+				ctx->classes[0] = C_IN;
+				ctx->classes[1] = C_HS;
+			} else if (n == 1
+				   || ctx->classes[0] == ctx->classes[1])
+				ctx->classes[1] = 0;
+		}
 	}
 	fclose(fp);
 	return (0);
diff --git a/hesiod/hesiod_p.h b/hesiod/hesiod_p.h
index 71aca0976d..5010d71bc9 100644
--- a/hesiod/hesiod_p.h
+++ b/hesiod/hesiod_p.h
@@ -41,6 +41,7 @@ struct hesiod_p {
 	void		(*res_set)(struct hesiod_p *, struct __res_state *,
 				   void (*)(void *));
 	struct __res_state * (*res_get)(struct hesiod_p *);
+	int		classes[2];	/* The class search order. */
 };
 
 #define MAX_HESRESP	1024
diff --git a/iconvdata/ibm930.h b/iconvdata/ibm930.h
index cbf24c39c2..739a88fe9d 100644
--- a/iconvdata/ibm930.h
+++ b/iconvdata/ibm930.h
@@ -45,7 +45,7 @@ static const uint16_t __ibm930sb_to_ucs4[256] =
   /* 0x40 */ 0x0020, 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0xFF66, 0xFF67,
   /* 0x48 */ 0xFF68, 0xFF69, 0x00A3, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C,
   /* 0x50 */ 0x0026, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F, 0x0000,
-  /* 0x58 */ 0xFF70, 0x0000, 0x0021, 0x005C, 0x002A, 0x0029, 0x003B, 0x00AC,
+  /* 0x58 */ 0xFF70, 0x0000, 0x0021, 0x00A5, 0x002A, 0x0029, 0x003B, 0x00AC,
   /* 0x60 */ 0x002D, 0x002F, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066,
   /* 0x68 */ 0x0067, 0x0068, 0x0000, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
   /* 0x70 */ 0x005B, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
diff --git a/iconvdata/ibm939.c b/iconvdata/ibm939.c
index aae08ba3d1..50b083f492 100644
--- a/iconvdata/ibm939.c
+++ b/iconvdata/ibm939.c
@@ -1,5 +1,5 @@
 /* Conversion to and from IBM939.
-   Copyright (C) 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
 
@@ -200,16 +200,14 @@ enum
     if (__builtin_expect (ch >= 0xffff, 0))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
-	rp1 = NULL;							      \
-	rp2 = NULL;							      \
+	goto ibm939_invalid_char;					      \
       }									      \
-    else								      \
-      while (ch > rp1->end)						      \
-	++rp1;								      \
+									      \
+    while (ch > rp1->end)						      \
+      ++rp1;								      \
 									      \
     /* Use the UCS4 table for single byte.  */				      \
-    if (__builtin_expect (rp1 == NULL, 0)				      \
-	|| __builtin_expect (ch < rp1->start, 0)			      \
+    if (__builtin_expect (ch < rp1->start, 0)				      \
 	|| (cp = __ucs4_to_ibm939sb[ch + rp1->idx],			      \
 	    __builtin_expect (cp[0], L'\1') == L'\0' && ch != '\0'))	      \
       {									      \
@@ -217,12 +215,12 @@ enum
 	while (ch > rp2->end)						      \
 	  ++rp2;							      \
 									      \
-	if (__builtin_expect (rp2 == NULL, 0)				      \
-	    || __builtin_expect (ch < rp2->start, 0)			      \
+	if (__builtin_expect (ch < rp2->start, 0)			      \
 	    || (cp = __ucs4_to_ibm939db[ch + rp2->idx],			      \
 		__builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0'))	      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
+	  ibm939_invalid_char:						      \
 	    STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 	  }								      \
 	else								      \
diff --git a/iconvdata/ibm939.h b/iconvdata/ibm939.h
index 0597294ac6..900a5e2445 100644
--- a/iconvdata/ibm939.h
+++ b/iconvdata/ibm939.h
@@ -56,7 +56,7 @@ static const uint16_t __ibm939sb_to_ucs4[256] =
   /* 0x98 */ 0x0071, 0x0072, 0xFF89, 0xFF8A, 0xFF8B, 0xFF8C, 0xFF8D, 0xFF8E,
   /* 0xa0 */ 0x203E, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078,
   /* 0xa8 */ 0x0079, 0x007A, 0xFF8F, 0xFF90, 0xFF91, 0x005B, 0xFF92, 0xFF93,
-  /* 0xb0 */ 0x005E, 0x00A3, 0x005C, 0xFF94, 0xFF95, 0xFF96, 0xFF97, 0xFF98,
+  /* 0xb0 */ 0x005E, 0x00A3, 0x00A5, 0xFF94, 0xFF95, 0xFF96, 0xFF97, 0xFF98,
   /* 0xb8 */ 0xFF99, 0xFF9A, 0xFF9B, 0xFF9C, 0xFF9D, 0x005D, 0xFF9E, 0xFF9F,
   /* 0xc0 */ 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
   /* 0xc8 */ 0x0048, 0x0049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
diff --git a/iconvdata/testdata/IBM930..UTF8 b/iconvdata/testdata/IBM930..UTF8
index 89df7f15ac..639a16fdac 100644
--- a/iconvdata/testdata/IBM930..UTF8
+++ b/iconvdata/testdata/IBM930..UTF8
Binary files differdiff --git a/iconvdata/testdata/IBM939..UTF8 b/iconvdata/testdata/IBM939..UTF8
index 89df7f15ac..639a16fdac 100644
--- a/iconvdata/testdata/IBM939..UTF8
+++ b/iconvdata/testdata/IBM939..UTF8
Binary files differdiff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index 2d02ff2096..9a22082287 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -5,4 +5,8 @@ libc_hidden_proto (pmap_getport)
 libc_hidden_proto (pmap_set)
 libc_hidden_proto (pmap_unset)
 
+/* Defined in pm_getport.c.  */
+extern int __get_socket (struct sockaddr_in *saddr)
+     attribute_hidden internal_function;
+
 #endif
diff --git a/include/stdlib.h b/include/stdlib.h
index 7723bf6856..49e87576f3 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -95,8 +95,8 @@ extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d)
 
 extern void __cxa_finalize (void *d);
 
-extern int __posix_memalign (void **memptr, size_t alignment, size_t size)
-     __attribute_malloc__;
+extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
+
 extern void *__libc_memalign (size_t alignment, size_t size)
      __attribute_malloc__;
 
diff --git a/include/string.h b/include/string.h
index 738dd8e27c..532d5ed333 100644
--- a/include/string.h
+++ b/include/string.h
@@ -96,6 +96,7 @@ libc_hidden_builtin_proto (strcmp)
 libc_hidden_builtin_proto (strcpy)
 libc_hidden_builtin_proto (strcspn)
 libc_hidden_builtin_proto (strlen)
+libc_hidden_builtin_proto (strnlen)
 libc_hidden_builtin_proto (strncmp)
 libc_hidden_builtin_proto (strncpy)
 libc_hidden_builtin_proto (strpbrk)
diff --git a/io/sys/sendfile.h b/io/sys/sendfile.h
index 24256b5414..4c1367b6be 100644
--- a/io/sys/sendfile.h
+++ b/io/sys/sendfile.h
@@ -32,19 +32,19 @@ __BEGIN_DECLS
    case of error.  */
 #ifndef __USE_FILE_OFFSET64
 extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset,
-			 size_t __count) __THROW __nonnull ((3));
+			 size_t __count) __THROW;
 #else
 # ifdef __REDIRECT_NTH
 extern ssize_t __REDIRECT_NTH (sendfile,
 			       (int __out_fd, int __in_fd, __off64_t *__offset,
-				size_t __count), sendfile64) __nonnull ((3));
+				size_t __count), sendfile64);
 # else
 #  define sendfile sendfile64
 # endif
 #endif
 #ifdef __USE_LARGEFILE64
 extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset,
-			   size_t __count) __THROW __nonnull ((3));
+			   size_t __count) __THROW;
 #endif
 
 __END_DECLS
diff --git a/locale/iso-4217.def b/locale/iso-4217.def
index 01a69950dc..b7c05a351d 100644
--- a/locale/iso-4217.def
+++ b/locale/iso-4217.def
@@ -43,6 +43,7 @@ DEFINE_INT_CURR("CLP")		/* Chilean Peso  */
 DEFINE_INT_CURR("CNY")		/* China Yuan Renminbi  */
 DEFINE_INT_CURR("COP")		/* Colombian Peso  */
 DEFINE_INT_CURR("CRC")		/* Costa Rican Colon  */
+DEFINE_INT_CURR("CSD")		/* Serbian Dinar  */
 DEFINE_INT_CURR("CUP")		/* Cuban Peso  */
 DEFINE_INT_CURR("CVE")		/* Cape Verde Escudo  */
 DEFINE_INT_CURR("CYP")		/* Cypriot Pound  */
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 6ec526dc1f..c04fe161e5 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,8 +1,48 @@
+2005-05-28  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #622]
+	* locales/pa_IN (am_pm): Fix typos.
+	Patch by Denis Barbier <barbier@linuxfr.org>.
+
+2005-05-22  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1092]
+	* locales/mn_MN: Update.  Patch by Sanlig Badral <s_badral@yahoo.com>.
+
+2005-04-28  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1084]
+	* SUPPORTED: Add UTF-8 locales where UTF-8 was not already supported.
+
+2005-04-26  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1091]
+	* locales/fa_IR: Add alt_digits, change date and time
+	representation, and various cleanups.
+	Patch by Hamed Malek <hamed@bamdad.org>.
+
 2005-03-21  Jakub Jelinek  <jakub@redhat.com>
 
 	[BZ #823]
 	* charmaps/WINDOWS-31J: Add % before alias keyword.
 
+2005-03-18  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1084]
+	* SUPPORTED (SUPPORTED-LOCALES): Add af_ZA.UTF-8.
+
+2005-02-27  Denis Barbier  <barbier@debian.org>
+
+	[BZ #38]
+	* locales/sr_CS: New file.
+	Contributed by Danilo Segan <dsegan@gmx.net>
+	* SUPPORTED: Add sr_CS/ISO-8859-5 and sr_CS.UTF-8/UTF-8.
+
+2005-03-18  Andreas Schwab  <schwab@suse.de>
+
+	[BZ #622]
+	* locales/pa_IN (am_pm): Fix character names.
+
 2004-12-19  Roland McGrath  <roland@frob.com>
 
 	* gen-unicode-ctype.c (output_tables): Fix email address in output.
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
index b5865ef856..5f8acd14c1 100644
--- a/localedata/SUPPORTED
+++ b/localedata/SUPPORTED
@@ -1,12 +1,15 @@
 # This file names the currently supported and somewhat tested locales.
 # If you have any additions please file a glibc bug report.
 SUPPORTED-LOCALES=\
+aa_DJ.UTF-8/UTF-8 \
 aa_DJ/ISO-8859-1 \
 aa_ER/UTF-8 \
 aa_ER@saaho/UTF-8 \
 aa_ET/UTF-8 \
+af_ZA.UTF-8/UTF-8 \
 af_ZA/ISO-8859-1 \
 am_ET/UTF-8 \
+an_ES.UTF-8/UTF-8 \
 an_ES/ISO-8859-15 \
 ar_AE.UTF-8/UTF-8 \
 ar_AE/ISO-8859-6 \
@@ -50,8 +53,10 @@ bg_BG.UTF-8/UTF-8 \
 bg_BG/CP1251 \
 bn_BD/UTF-8 \
 bn_IN/UTF-8 \
+br_FR.UTF-8/UTF-8 \
 br_FR/ISO-8859-1 \
 br_FR@euro/ISO-8859-15 \
+bs_BA.UTF-8/UTF-8 \
 bs_BA/ISO-8859-2 \
 byn_ER/UTF-8 \
 ca_ES.UTF-8/UTF-8 \
@@ -179,6 +184,7 @@ fr_LU@euro/ISO-8859-15 \
 ga_IE.UTF-8/UTF-8 \
 ga_IE/ISO-8859-1 \
 ga_IE@euro/ISO-8859-15 \
+gd_GB.UTF-8/UTF-8 \
 gd_GB/ISO-8859-15 \
 gez_ER/UTF-8 \
 gez_ER@abegede/UTF-8 \
@@ -210,7 +216,9 @@ iw_IL.UTF-8/UTF-8 \
 iw_IL/ISO-8859-8 \
 ja_JP.EUC-JP/EUC-JP \
 ja_JP.UTF-8/UTF-8 \
+ka_GE.UTF-8/UTF-8 \
 ka_GE/GEORGIAN-PS \
+kk_KZ.UTF-8/UTF-8 \
 kk_KZ/PT154 \
 kl_GL.UTF-8/UTF-8 \
 kl_GL/ISO-8859-1 \
@@ -219,12 +227,14 @@ ko_KR.EUC-KR/EUC-KR \
 ko_KR.UTF-8/UTF-8 \
 kw_GB.UTF-8/UTF-8 \
 kw_GB/ISO-8859-1 \
+lg_UG.UTF-8/UTF-8 \
 lg_UG/ISO-8859-10 \
 lo_LA/UTF-8 \
 lt_LT.UTF-8/UTF-8 \
 lt_LT/ISO-8859-13 \
 lv_LV.UTF-8/UTF-8 \
 lv_LV/ISO-8859-13 \
+mi_NZ.UTF-8/UTF-8 \
 mi_NZ/ISO-8859-13 \
 mk_MK.UTF-8/UTF-8 \
 mk_MK/ISO-8859-5 \
@@ -248,8 +258,10 @@ nn_NO.UTF-8/UTF-8 \
 nn_NO/ISO-8859-1 \
 no_NO.UTF-8/UTF-8 \
 no_NO/ISO-8859-1 \
+oc_FR.UTF-8/UTF-8 \
 oc_FR/ISO-8859-1 \
 om_ET/UTF-8 \
+om_KE.UTF-8/UTF-8 \
 om_KE/ISO-8859-1 \
 pa_IN/UTF-8 \
 pl_PL.UTF-8/UTF-8 \
@@ -272,12 +284,17 @@ sk_SK.UTF-8/UTF-8 \
 sk_SK/ISO-8859-2 \
 sl_SI.UTF-8/UTF-8 \
 sl_SI/ISO-8859-2 \
+so_DJ.UTF-8/UTF-8 \
 so_DJ/ISO-8859-1 \
 so_ET/UTF-8 \
+so_KE.UTF-8/UTF-8 \
 so_KE/ISO-8859-1 \
+so_SO.UTF-8/UTF-8 \
 so_SO/ISO-8859-1 \
 sq_AL.UTF-8/UTF-8 \
 sq_AL/ISO-8859-1 \
+sr_CS.UTF-8/UTF-8 \
+sr_CS/ISO-8859-5 \
 st_ZA.UTF-8/UTF-8 \
 st_ZA/ISO-8859-1 \
 sv_FI.UTF-8/UTF-8 \
@@ -288,12 +305,14 @@ sv_SE/ISO-8859-1 \
 sv_SE.ISO-8859-15/ISO-8859-15 \
 ta_IN/UTF-8 \
 te_IN/UTF-8 \
+tg_TJ.UTF-8/UTF-8 \
 tg_TJ/KOI8-T \
 th_TH.UTF-8/UTF-8 \
 th_TH/TIS-620 \
 ti_ER/UTF-8 \
 ti_ET/UTF-8 \
 tig_ER/UTF-8 \
+tl_PH.UTF-8/UTF-8 \
 tl_PH/ISO-8859-1 \
 tr_TR.UTF-8/UTF-8 \
 tr_TR/ISO-8859-9 \
@@ -310,6 +329,7 @@ wa_BE@euro/ISO-8859-15 \
 wa_BE.UTF-8/UTF-8 \
 xh_ZA.UTF-8/UTF-8 \
 xh_ZA/ISO-8859-1 \
+yi_US.UTF-8/UTF-8 \
 yi_US/CP1255 \
 zh_CN.GB18030/GB18030 \
 zh_CN.GBK/GBK \
@@ -317,6 +337,7 @@ zh_CN.UTF-8/UTF-8 \
 zh_CN/GB2312 \
 zh_HK.UTF-8/UTF-8 \
 zh_HK/BIG5-HKSCS \
+zh_SG.UTF-8/UTF-8 \
 zh_SG.GBK/GBK \
 zh_SG/GB2312 \
 zh_TW.EUC-TW/EUC-TW \
diff --git a/localedata/locales/fa_IR b/localedata/locales/fa_IR
index 8f65b1edd8..15fb535640 100644
--- a/localedata/locales/fa_IR
+++ b/localedata/locales/fa_IR
@@ -10,8 +10,8 @@ escape_char  /
 % Fax: +98 21 6019568
 % Language: fa
 % Territory: IR
-% Revision: 2.4
-% Date: 2004-09-04
+% Revision: 3.0
+% Date: 2005-04-06
 % Users: general
 % Repertoiremap:
 % Charset: UTF-8
@@ -28,28 +28,31 @@ tel        "+98 21 6022372"
 fax        "+98 21 6019568"
 language   "Persian"
 territory  "Iran"
-revision   "2.3"
-date       "2004-03-16"
+revision   "3.0"
+date       "2005-04-06"
 %
-category  "fa_IR:2004";LC_IDENTIFICATION
-category  "fa_IR:2004";LC_CTYPE
-category  "fa_IR:2004";LC_COLLATE
-category  "fa_IR:2004";LC_TIME
-category  "fa_IR:2004";LC_NUMERIC
-category  "fa_IR:2004";LC_MONETARY
-category  "fa_IR:2004";LC_MESSAGES
-category  "fa_IR:2004";LC_PAPER
-category  "fa_IR:2004";LC_NAME
-category  "fa_IR:2004";LC_ADDRESS
-category  "fa_IR:2004";LC_TELEPHONE
+category  "fa_IR:2005";LC_IDENTIFICATION
+category  "fa_IR:2005";LC_CTYPE
+category  "fa_IR:2005";LC_COLLATE
+category  "fa_IR:2005";LC_TIME
+category  "fa_IR:2005";LC_NUMERIC
+category  "fa_IR:2005";LC_MONETARY
+category  "fa_IR:2005";LC_MESSAGES
+category  "fa_IR:2005";LC_PAPER
+category  "fa_IR:2005";LC_NAME
+category  "fa_IR:2005";LC_ADDRESS
+category  "fa_IR:2005";LC_TELEPHONE
 
 END LC_IDENTIFICATION
 
 LC_CTYPE
 copy "i18n"
 
+% Persian uses the alternate digits U+06F0..U+06F9
 outdigit <U06F0>..<U06F9>
 
+% This is used in the scanf family of functions to read Persian numbers
+% using "%Id" and such.
 map to_inpunct; /
   (<U0030>,<U06F0>); /
   (<U0031>,<U06F1>); /
@@ -64,6 +67,8 @@ map to_inpunct; /
   (<U002E>,<U066B>); /
   (<U002C>,<U066C>)
 
+% This is used in the printf family of functions to write Persian floating
+% point numbers using "%If" and such.
 map to_outpunct; /
   (<U002E>,<U066B>); /
   (<U002C>,<U066C>)
@@ -76,7 +81,7 @@ copy "iso14651_t1"
 % kinds), BEH, PEH, TEH, JEEM, TCHEH, HAH, KHAH, DAL, THAL, REH, ZAIN, JEH,
 % SEEN, SHEEN, SAD, DAD, TAH, ZAH, AIN, GHAIN, FEH, QAF, KAF, GAF, LAM,
 % MEEM, NOON, WAW, HEH, YEH.
-% The various kind of HAMZA are sorted as ALEF WITH HAMZA ABOVE, ALEF WITH
+% The various kinds of HAMZA are sorted as ALEF WITH HAMZA ABOVE, ALEF WITH
 % HAMZA BELOW, WAW WITH HAMZA ABOVE, YEH WITH HAMZA ABOVE.
 
 collating-symbol <AHY> % accent hamza over yeh
@@ -122,7 +127,7 @@ reorder-after <waw>
 <heh>
 <yeh>
 
-% Persian uses fatha, kasra, damma, fathatan, kasratan, dammatan order.
+% Persian uses this order: Fatha, Kasra, Damma, Fathatan, Kasratan, Dammatan.
 
 reorder-after <U066D>
 <U064E> IGNORE;IGNORE;IGNORE;<U064E> %<fatha_no>
@@ -148,7 +153,7 @@ reorder-after <UFE7F>
 <U0655> IGNORE;IGNORE;IGNORE;<U0655> %<hamzabelow_no>
 <U0670> IGNORE;IGNORE;IGNORE;<U0670> %<supalef_no>
 
-% Persian digits are sorted before Arabic ones: they are the basic forms.
+% The Persian digits are sorted before the Arabic ones: they are the basic forms.
 reorder-after <U0660>
 <U06F0> <0>;<BAS>;<MIN>;IGNORE
 <U0660> <0>;<PCL>;<MIN>;IGNORE
@@ -292,14 +297,72 @@ grouping          3
 END LC_NUMERIC
 
 LC_TIME
-abday   "<U06CC><U002E>";"<U062F><U002E>";"<U0633><U002E>";/
-        "<U0686><U002E>";"<U067E><U002E>";"<U062C><U002E>";/
-        "<U0634><U002E>"
-day     "<U06CC><U06A9><U200C><U0634><U0646><U0628><U0647>";/
+% Alternative digits are used for Persian numerals in date and time. This is
+% a hack, until a new prefix is defined for alternative digits.
+alt_digits	"<U06F0><U06F0>";"<U06F0><U06F1>";/
+		"<U06F0><U06F2>";"<U06F0><U06F3>";/
+		"<U06F0><U06F4>";"<U06F0><U06F5>";/
+		"<U06F0><U06F6>";"<U06F0><U06F7>";/
+		"<U06F0><U06F8>";"<U06F0><U06F9>";/
+		"<U06F1><U06F0>";"<U06F1><U06F1>";/
+		"<U06F1><U06F2>";"<U06F1><U06F3>";/
+		"<U06F1><U06F4>";"<U06F1><U06F5>";/
+		"<U06F1><U06F6>";"<U06F1><U06F7>";/
+		"<U06F1><U06F8>";"<U06F1><U06F9>";/
+		"<U06F2><U06F0>";"<U06F2><U06F1>";/
+		"<U06F2><U06F2>";"<U06F2><U06F3>";/
+		"<U06F2><U06F4>";"<U06F2><U06F5>";/
+		"<U06F2><U06F6>";"<U06F2><U06F7>";/
+		"<U06F2><U06F8>";"<U06F2><U06F9>";/
+		"<U06F3><U06F0>";"<U06F3><U06F1>";/
+		"<U06F3><U06F2>";"<U06F3><U06F3>";/
+		"<U06F3><U06F4>";"<U06F3><U06F5>";/
+		"<U06F3><U06F6>";"<U06F3><U06F7>";/
+		"<U06F3><U06F8>";"<U06F3><U06F9>";/
+		"<U06F4><U06F0>";"<U06F4><U06F1>";/
+		"<U06F4><U06F2>";"<U06F4><U06F3>";/
+		"<U06F4><U06F4>";"<U06F4><U06F5>";/
+		"<U06F4><U06F6>";"<U06F4><U06F7>";/
+		"<U06F4><U06F8>";"<U06F4><U06F9>";/
+		"<U06F5><U06F0>";"<U06F5><U06F1>";/
+		"<U06F5><U06F2>";"<U06F5><U06F3>";/
+		"<U06F5><U06F4>";"<U06F5><U06F5>";/
+		"<U06F5><U06F6>";"<U06F5><U06F7>";/
+		"<U06F5><U06F8>";"<U06F5><U06F9>";/
+		"<U06F6><U06F0>";"<U06F6><U06F1>";/
+		"<U06F6><U06F2>";"<U06F6><U06F3>";/
+		"<U06F6><U06F4>";"<U06F6><U06F5>";/
+		"<U06F6><U06F6>";"<U06F6><U06F7>";/
+		"<U06F6><U06F8>";"<U06F6><U06F9>";/
+		"<U06F7><U06F0>";"<U06F7><U06F1>";/
+		"<U06F7><U06F2>";"<U06F7><U06F3>";/
+		"<U06F7><U06F4>";"<U06F7><U06F5>";/
+		"<U06F7><U06F6>";"<U06F7><U06F7>";/
+		"<U06F7><U06F8>";"<U06F7><U06F9>";/
+		"<U06F8><U06F0>";"<U06F8><U06F1>";/
+		"<U06F8><U06F2>";"<U06F8><U06F3>";/
+		"<U06F8><U06F4>";"<U06F8><U06F5>";/
+		"<U06F8><U06F6>";"<U06F8><U06F7>";/
+		"<U06F8><U06F8>";"<U06F8><U06F9>";/
+		"<U06F9><U06F0>";"<U06F9><U06F1>";/
+		"<U06F9><U06F2>";"<U06F9><U06F3>";/
+		"<U06F9><U06F4>";"<U06F9><U06F5>";/
+		"<U06F9><U06F6>";"<U06F9><U06F7>";/
+		"<U06F9><U06F8>";"<U06F9><U06F9>"
+% Persian doesn't have abbreviations for weekdays and month names, so
+% "abday" is the same as "day" and "abmon" is the same as "mon"
+abday   "<U06CC><U06A9><U0634><U0646><U0628><U0647>";/
         "<U062F><U0648><U0634><U0646><U0628><U0647>";/
         "<U0633><U0647><U200C><U0634><U0646><U0628><U0647>";/
         "<U0686><U0647><U0627><U0631><U0634><U0646><U0628><U0647>";/
-        "<U067E><U0646><U062C><U200C><U0634><U0646><U0628><U0647>";/
+        "<U067E><U0646><U062C><U0634><U0646><U0628><U0647>";/
+        "<U062C><U0645><U0639><U0647>";/
+        "<U0634><U0646><U0628><U0647>"
+day     "<U06CC><U06A9><U0634><U0646><U0628><U0647>";/
+        "<U062F><U0648><U0634><U0646><U0628><U0647>";/
+        "<U0633><U0647><U200C><U0634><U0646><U0628><U0647>";/
+        "<U0686><U0647><U0627><U0631><U0634><U0646><U0628><U0647>";/
+        "<U067E><U0646><U062C><U0634><U0646><U0628><U0647>";/
         "<U062C><U0645><U0639><U0647>";/
         "<U0634><U0646><U0628><U0647>"
 mon     "<U0698><U0627><U0646><U0648><U06CC><U0647>";/
@@ -314,33 +377,68 @@ mon     "<U0698><U0627><U0646><U0648><U06CC><U0647>";/
         "<U0627><U0643><U062A><U0628><U0631>";/
         "<U0646><U0648><U0627><U0645><U0628><U0631>";/
         "<U062F><U0633><U0627><U0645><U0628><U0631>"
-abmon   "<U0698><U0627><U0646>";"<U0641><U0648><U0631>";/
-        "<U0645><U0627><U0631>";"<U0622><U0648><U0631>";/
-        "<U0645><U0640><U0647>";"<U0698><U0648><U0646>";/
-        "<U0698><U0648><U06CC>";"<U0627><U0648><U062A>";/
-        "<U0633><U067E><U062A>";"<U0627><U0643><U062A>";/
-        "<U0646><U0648><U0627>";"<U062F><U0633><U0627>"
-am_pm   "<U0635><U0628><U062D>";"<U0639><U0635><U0631>"
-d_t_fmt "<U202B><U0025><U0041><U0020><U0025><U0065><U0020><U0025>/
-<U0042><U0020><U0025><U0059><U060C><U0020><U0025><U0049><U003A>/
-<U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070><U202C>"
-d_fmt   "<U0025><U0059><U002F><U0025><U006D><U002F><U0025><U0064>"
-t_fmt   "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
-t_fmt_ampm    "<U202B><U0025><U0049><U003A><U0025><U004D><U003A><U0025>/
-<U0053><U0020><U0025><U0070><U202C>"
-%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>"
+abmon   "<U0698><U0627><U0646><U0648><U06CC><U0647>";/
+        "<U0641><U0648><U0631><U06CC><U0647>";/
+        "<U0645><U0627><U0631><U0633>";/
+        "<U0622><U0648><U0631><U06CC><U0644>";/
+        "<U0645><U0647>";/
+        "<U0698><U0648><U0626><U0646>";/
+        "<U0698><U0648><U0626><U06CC><U0647>";/
+        "<U0627><U0648><U062A>";/
+        "<U0633><U067E><U062A><U0627><U0645><U0628><U0631>";/
+        "<U0627><U0643><U062A><U0628><U0631>";/
+        "<U0646><U0648><U0627><U0645><U0628><U0631>";/
+        "<U062F><U0633><U0627><U0645><U0628><U0631>"
+% Persian does not have the 12-hour format
+am_pm   "";""
+t_fmt_ampm    ""
+%
+% Appropriate date representation (%x)
+%       "%Oy/%Om/%Od"
+d_fmt   "<U0025><U004F><U0079><U002F>/
+<U0025><U004F><U006D><U002F>/
+<U0025><U004F><U0064>"
+%
+% Appropriate time representation (%X)
+%       "%OH:%OM:%OS"
+t_fmt   "<U0025><U004F><U0048><U003A>/
+<U0025><U004F><U004D><U003A>/
+<U0025><U004F><U0053>"
+%
+% FIXME: need to add "HAMZA ABOVE" after January, February, May, July when used
+% before a year
+%
+% Appropriate date and time representation (%c)
+%       "<RLE>%A %Oe %B %Oy<ARABIC COMMA> %OH:%OM:%OS<PDF>"
+d_t_fmt "<U202B><U0025><U0041><U0020>/
+<U0025><U004F><U0065><U0020>/
+<U0025><U0042><U0020>/
+<U0025><U004F><U0079><U060C><U0020>/
+<U0025><U004F><U0048><U003A>/
+<U0025><U004F><U004D><U003A>/
+<U0025><U004F><U0053><U202C>"
+%
+% Appropriate date representation (date(1))
+%       "<RLE>%A %Oe %B %Oy<ARABIC COMMA> <SEEN><ALEF><AIN><TEH> %OH:%OM:%OS (%Z)<PDF>"
+date_fmt "<U202B><U0025><U0041><U0020>/
+<U0025><U004F><U0065><U0020>/
+<U0025><U0042><U0020>/
+<U0025><U004F><U0079><U060C><U0020>/
+<U0633><U0627><U0639><U062A><U0020>/
+<U0025><U004F><U0048><U003A>/
+<U0025><U004F><U004D><U003A>/
+<U0025><U004F><U0053><U0020>/
+<U0028><U0025><U005A><U0029><U202C>"
 first_weekday 7
 first_workday 7
 cal_direction 3
-%week    7;19971206;4
-%time_zone "???"
 END LC_TIME
 
 LC_MESSAGES
-yesexpr "<U005E><U005B><U0079><U0059><U0628><U0066><U005D><U002E><U002A>"
-noexpr  "<U005E><U005B><U006E><U004E><U062E><U0646><U006F><U005D><U002E><U002A>"
+% This is "^[yY<ALEF MADDA><BEH>Hf].*"
+yesexpr "<U005E><U005B><U0079><U0059><U0622><U0628><U0048><U0066><U005D><U002E><U002A>"
+% This is "^[nN<KHAH><NOON>ok].*"
+noexpr  "<U005E><U005B><U006E><U004E><U062E><U0646><U006F><U006B><U005D><U002E><U002A>"
 END LC_MESSAGES
 
 LC_PAPER
@@ -348,18 +446,6 @@ height   297
 width    210
 END LC_PAPER
 
-LC_TELEPHONE
-tel_int_fmt    "<U202A><U002B><U0025><U0063><U0020><U0025><U0061><U0020>/
-<U0025><U006C><U202C>"
-tel_dom_fmt    "<U202A><U0025><U0041><U2012><U0025><U006C><U202C>"
-int_select     "<U0030><U0030>"
-int_prefix     "<U0039><U0038>"
-END LC_TELEPHONE
-
-LC_MEASUREMENT
-measurement    1
-END LC_MEASUREMENT
-
 LC_NAME
 name_gen    ""
 name_miss   "<U062E><U0627><U0646><U0645>"
@@ -371,7 +457,6 @@ name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0073><U0025><U0074>/
 END LC_NAME
 
 LC_ADDRESS
-% FIXME
 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>/
@@ -388,3 +473,15 @@ lang_ab        "<U0066><U0061>"
 lang_term      "<U0066><U0061><U0073>"
 lang_lib       "<U0070><U0065><U0072>"
 END LC_ADDRESS
+
+LC_TELEPHONE
+tel_int_fmt    "<U202A><U002B><U0025><U0063><U0020><U0025><U0061><U0020>/
+<U0025><U006C><U202C>"
+tel_dom_fmt    "<U202A><U0025><U0041><U2012><U0025><U006C><U202C>"
+int_select     "<U0030><U0030>"
+int_prefix     "<U0039><U0038>"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+measurement    1
+END LC_MEASUREMENT
diff --git a/localedata/locales/mn_MN b/localedata/locales/mn_MN
index 5bea18cc4b..2921487314 100644
--- a/localedata/locales/mn_MN
+++ b/localedata/locales/mn_MN
@@ -1,25 +1,27 @@
-comment_char %
 escape_char /
+comment_char %
 % Mongolian language (cyrillic) locale for Mongolia
 % Sanlig Badral <badral@chinggis.com>
-% Revision: 0.9 (2003-2-27)
+% Revision: 1.0 (2005-5-21)
 % Charsets: UTF-8
 % Distribution and use is free, also
 % for commercial purposes.
 
 LC_IDENTIFICATION
 title      "Mongolian locale for Mongolia"
-source     "OPENMN"
+source     "Sanlig Badral"
 address    ""
 contact    ""
-email      "bug-glibc-locales@gnu.org"
+email      "badral@chinggis.com"
 tel        ""
 fax        ""
 language   "Mongolian"
 territory  "Mongolia"
-revision   "0.9"
-date       "2003-02-27"
-
+revision   "1.0"
+date       "2005-05-21"
+audience   "general"
+application   "GNU locale"
+%
 category  "mn_MN:2000";LC_IDENTIFICATION
 category  "mn_MN:2000";LC_CTYPE
 category  "mn_MN:2000";LC_COLLATE
@@ -64,6 +66,82 @@ END LC_COLLATE
 
 LC_CTYPE
 copy "i18n"
+translit_start
+include "translit_combining";""
+% cyrillic -> latin for mongolian
+% CYRILLIC CAPITAL LETTERS IN ALPHABETICAL ORDER.
+<U0410> "<U0041>"
+<U0411> "<U0042>"
+<U0412> "<U0056>"
+<U0413> "<U0047>"
+<U0414> "<U0044>"
+<U0415> "<U0059><U0065>" % Ye
+<U0401> "<U0059><U006F>" % Yo
+<U0416> "<U004A>"
+<U0417> "<U005A>"
+<U0418> "<U0049>"
+<U0419> "<U0049>"
+<U041A> "<U004B>"
+<U041B> "<U004C>"
+<U041C> "<U004D>"
+<U041D> "<U004E>"
+<U041E> "<U004F>"
+<U04E8> "<U004F><U0065>" % Oe
+<U041F> "<U0050>"
+<U0420> "<U0052>"
+<U0421> "<U0053>"
+<U0422> "<U0054>"
+<U0423> "<U0055>"
+<U04AE> "<U0055><U0065>" % Ue
+<U0424> "<U0046>"
+<U0425> "<U0048>"
+<U0426> "<U0043>"
+<U0427> "<U0043><U0068>" % Ch
+<U0428> "<U0053><U0068>" % Sh
+<U0429> "<U0053><U0068>" % Sh
+<U042A> "<U0022>" % "
+<U042B> "<U0059>"
+<U042C> "<U0027>" % '
+<U042D> "<U0045>" 
+<U042E> "<U0059><U0075>" % Yu
+<U042F> "<U0059><U0061>" % Ya
+% CYRILLIC SMALL LETTERS IN ALPHABETICAL ORDER.
+<U0430> "<U0061>"
+<U0431> "<U0062>"
+<U0432> "<U0076>"
+<U0433> "<U0067>"
+<U0434> "<U0064>"
+<U0435> "<U0079><U0065>" %ye
+<U0451> "<U0079><U006F>" %yo
+<U0436> "<U006A>"
+<U0437> "<U007A>"
+<U0438> "<U0069>"
+<U0439> "<U0069>"
+<U043A> "<U006B>"
+<U043B> "<U006C>"
+<U043C> "<U006D>"
+<U043D> "<U006E>"
+<U043E> "<U006F>"
+<U04E9> "<U006F><U0065>" % oe
+<U043F> "<U0070>"
+<U0440> "<U0072>"
+<U0441> "<U0073>"
+<U0442> "<U0074>"
+<U0443> "<U0075>"
+<U04AF> "<U0075><U0065>" % ue
+<U0444> "<U0066>"
+<U0445> "<U0068>"
+<U0446> "<U0043>"
+<U0447> "<U0063><U0068>" % ch
+<U0448> "<U0073><U0068>" % sh
+<U0449> "<U0073><U0068>" % sh
+<U044A> "<U0022>" % "
+<U044B> "<U0079>"
+<U044C> "<U0027>" % '
+<U044D> "<U0065>"
+<U044E> "<U0079><U0075>" % yu
+<U044F> "<U0079><U0061>" % ya
+translit_end
 END LC_CTYPE
 
 LC_MONETARY
@@ -106,28 +184,28 @@ day   "<U041D><U044F><U043C>";/
       "<U0411><U0430><U0430><U0441><U0430><U043D>";/
       "<U0411><U044F><U043C><U0431><U0430>"
 % Abbreviated month names (%b)
-abmon       "<U0031><U002D><U0440>";"<U0032><U002D><U0440>";/
-            "<U0033><U002D><U0440>";"<U0034><U002D><U0440>";/
-            "<U0035><U002D><U0440>";"<U0036><U002D><U0440>";/
-            "<U0037><U002D><U0440>";"<U0038><U002D><U0440>";/
-            "<U0039><U002D><U0440>";"<U0031><U0030><U002D><U0440>";/
-            "<U0031><U0031><U002D><U0440>";"<U0031><U0032><U002D><U0440>"
+abmon       "<U0425><U0443><U043B>";"<U04AE><U0445><U044D>";/
+            "<U0411><U0430><U0440>";"<U0422><U0443><U0443>";/
+            "<U041B><U0443><U0443>";"<U041C><U043E><U0433>";/
+            "<U041C><U043E><U0440>";"<U0425><U043E><U043D>";/
+            "<U0411><U0438><U0447>";"<U0422><U0430><U0445>";/
+            "<U041D><U043E><U0445>";"<U0413><U0430><U0445>"
 % Full month names (%B)
-mon         "<U041D><U044D><U0433><U0434><U04AF><U0433><U044D><U044D><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0425><U043E><U0451><U0440><U0434><U0443><U0433><U0430><U0430><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0413><U0443><U0440><U0430><U0432><U0434><U0443><U0433><U0430><U0430><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0414><U04E9><U0440><U04E9><U0432><U0434><U04AF><U0433><U044D><U044D><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0422><U0430><U0432><U0434><U0443><U0433><U0430><U0430><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0417><U0443><U0440><U0433><U0430><U0430><U0434><U0443><U0433><U0430><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0414><U043E><U043B><U043E><U043E><U0434><U0443><U0433><U0430><U0430><U0440><U0020><U0441><U0430><U0440>";/
-            "<U041D><U0430><U0439><U043C><U0434><U0443><U0433><U0430><U0430><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0415><U0441><U0434><U04AF><U0433><U044D><U044D><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0410><U0440><U0430><U0432><U0434><U0443><U0433><U0430><U0430><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0410><U0440><U0432><U0430><U043D><U043D><U044D><U0433><U0434><U04AF><U0433><U044D><U044D><U0440><U0020><U0441><U0430><U0440>";/
-            "<U0410><U0440><U0432><U0430><U043D><U0445><U043E><U0451><U0440><U0434><U0433><U0430><U0430><U0440><U0020><U0441><U0430><U0440>"
+mon         "<U0425><U0443><U043B><U0433><U0430><U043D><U0430><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U04AE><U0445><U044D><U0440><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U0411><U0430><U0440><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U0422><U0443><U0443><U043B><U0430><U0439><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U041B><U0443><U0443><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U041C><U043E><U0433><U043E><U0439><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U041C><U043E><U0440><U044C><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U0425><U043E><U043D><U044C><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U0411><U0438><U0447><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U0422><U0430><U0445><U0438><U0430><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U041D><U043E><U0445><U043E><U0439><U0020><U0441><U0430><U0440><U044B><U043D>";/
+            "<U0413><U0430><U0445><U0430><U0439><U0020><U0441><U0430><U0440><U044B><U043D>"
 % Appropriate date and time representation
-% "%a %d %b %Y %T %Z"
-d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+% "%Y %b %d, %a %T"
+d_t_fmt "<U0025><U0059><U0020><U0025><U0062><U0020><U0025><U0064><U002C><U0020><U0025><U0061><U0020><U0025><U0054>"
 
 % Appropriate date representation
 % "%Y.%m.%d"
@@ -139,8 +217,9 @@ t_fmt   "<U0025><U0054>"
 am_pm   "";""
 t_fmt_ampm ""
 % Full date and time representation
-% "%a %b %e %H:%M:%S %Z %Y"
-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>"
+% "%Z %Y ony %B %e, %a %H:%M:%S"
+date_fmt  "<U0025><U005A><U0020><U0025><U0059><U0020><U043E><U043D><U044B><U0020><U0025><U0042><U0020>";/
+	  "<U0025><U0065><U002C><U0020><U0025><U0061><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
 END LC_TIME
 
 LC_MESSAGES
@@ -157,7 +236,6 @@ END LC_PAPER
 LC_NAME
 name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
 <U0025><U006D><U0025><U0074><U0025><U0066>"
-
 name_miss   "<U0425><U0430><U0442><U0430><U0433><U0442><U0430><U0439>"
 name_mr     "<U041D><U043E><U0451><U043D>"
 name_mrs    "<U0425><U0430><U0442><U0430><U0433><U0442><U0430><U0439>"
@@ -170,7 +248,6 @@ postal_fmt    "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
 <U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
 <U004E><U0025><U0025><U007A><U0020><U0025><U0054><U0025>/
 <U004E><U0025><U0063><U0025><U004E>"
-
 country_name  "<U004D><U006F><U006E><U0067><U006F><U006C><U0069><U0061>"
 country_post  "<U004D><U004E>"
 country_ab2   "<U004D><U004E>"
diff --git a/localedata/locales/pa_IN b/localedata/locales/pa_IN
index 2a2072837b..f7b0bf2173 100644
--- a/localedata/locales/pa_IN
+++ b/localedata/locales/pa_IN
@@ -5,7 +5,7 @@ escape_char     /
 
 LC_IDENTIFICATION
 title      "Punjabi language locale for Indian Punjabi(Gurmukhi)"
-source     "IndLinux.org"	
+source     "IndLinux.org"
 address    ""
 contact    ""
 email      "bug-glibc-locales@gnu.org"
@@ -14,7 +14,7 @@ fax        ""
 language   "Punjabi"
 territory  "India"
 revision   "0.2"
-date       "2004-09-30"	
+date       "2004-09-30"
 %
 category  "pa_IN:2000";LC_IDENTIFICATION
 category  "pa_IN:2000";LC_CTYPE
@@ -122,8 +122,8 @@ mon         "<U0A1C><U0A28><U0A35><U0A30><U0A40>";/
 
 %
 % Equivalent of AM PM
-am_pm       "<U0A38><U035><U0A47><U0A30><U0A47>";/
-            "<U0A36><U0A3E><U02E>"
+am_pm       "<U0A38><U0A35><U0A47><U0A30><U0A47>";/
+            "<U0A36><U0A3E><U0A2E>"
 
 %
 % Appropriate date and time representation
diff --git a/localedata/locales/sr_CS b/localedata/locales/sr_CS
new file mode 100644
index 0000000000..1a01f2f101
--- /dev/null
+++ b/localedata/locales/sr_CS
@@ -0,0 +1,349 @@
+comment_char %
+escape_char  /
+%
+% Serbian Language Locale for Serbia and Montenegro
+% Source: sr_YU locale
+% Address:
+%
+% Contact: Danilo Segan
+% Email: dsegan@gmx.net
+% Tel: +381 63 8626082
+% Fax: none
+% Language: sr
+% Territory: CS
+% Revision: 1.2
+% Date: 2004-08-09
+% Application: general
+% Users: general
+% Charset: UTF-8, ISO-8859-5
+% Distribution and use is free, also
+% for commercial purposes.
+%
+% TODO:
+% -- fix LC_COLLATE to work correctly for latin alphabet too
+%
+
+LC_IDENTIFICATION
+title      "Serbian locale for Serbia and Montenegro"
+source     "sr_YU locale"
+address    ""
+contact    "Danilo Segan"
+email      "bug-glibc-locales@gnu.org"
+tel        ""
+fax        ""
+language   "Serbian"
+territory  "Serbia and Montenegro"
+revision   "1.2"
+date       "2004-08-09"
+audience   "general"
+application   "GNU locale"
+abbreviation  ""
+%
+category  "i18n:1997";LC_IDENTIFICATION
+category  "i18n:1997";LC_CTYPE
+category  "i18n:1997";LC_COLLATE
+category  "i18n:1997";LC_MONETARY
+category  "i18n:1997";LC_NUMERIC
+category  "i18n:1997";LC_TIME
+category  "i18n:1997";LC_MESSAGES
+category  "i18n:1997";LC_PAPER
+category  "i18n:1997";LC_NAME
+category  "i18n:1997";LC_ADDRESS
+category  "i18n:1997";LC_TELEPHONE
+category  "i18n:1997";LC_MEASUREMENT
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+translit_start
+include "translit_combining";""
+
+% cyrillic -> latin
+<U0452> "<U0111>";"<U0064><U006A>" % d-
+<U0453> "<U0067><U006A>" % gj
+<U0455> "<U0064><U007A>" % dz
+<U0458> "<U006A>" % j
+<U0459> "<U006C><U006A>" % lj
+<U045A> "<U006E><U006A>" % nj
+<U045B> "<U0107>";"<U0063>" % c'
+<U045C> "<U006B><U006A>" % kj
+<U045F> "<U0064><U017E>";"<U0064><U007A>" % dz<
+
+<U0402> "<U0110>";"<U0044><U006A>" % D-
+<U0403> "<U0047><U006A>" % Gj
+<U0405> "<U0044><U007A>" % Dz
+<U0408> "<U004A>" % J
+<U0409> "<U004C><U006A>" % Lj
+<U040A> "<U004E><U006A>" % Nj
+<U040B> "<U0106>";"<U0043>" % C'
+<U040C> "<U004B><U006A>" % Kj
+<U040F> "<U0044><U017E>";"<U0064><U007A>" % Dz<
+
+<U0430> "<U0061>"
+<U0431> "<U0062>"
+<U0446> "<U0063>"
+<U0434> "<U0064>"
+<U0435> "<U0065>"
+<U0444> "<U0066>"
+<U0433> "<U0067>"
+<U0445> "<U0068>"
+<U0438> "<U0069>"
+<U043A> "<U006B>"
+<U043B> "<U006C>"
+<U043C> "<U006D>"
+<U043D> "<U006E>"
+<U043E> "<U006F>"
+<U043F> "<U0070>"
+<U0440> "<U0072>"
+<U0441> "<U0073>"
+<U0442> "<U0074>"
+<U0443> "<U0075>"
+<U0432> "<U0076>"
+<U0437> "<U007A>"
+<U0436> "<U017E>";"<U007A>" % z<
+<U0448> "<U0161>";"<U0073>" % s<
+<U0447> "<U010D>";"<U0063>" % c<
+
+<U0410> "<U0041>"
+<U0411> "<U0042>"
+<U0426> "<U0043>"
+<U0414> "<U0044>"
+<U0415> "<U0045>"
+<U0424> "<U0046>"
+<U0413> "<U0047>"
+<U0425> "<U0048>"
+<U0418> "<U0049>"
+<U041A> "<U004B>"
+<U041B> "<U004C>"
+<U041C> "<U004D>"
+<U041D> "<U004E>"
+<U041E> "<U004F>"
+<U041F> "<U0050>"
+<U0420> "<U0052>"
+<U0421> "<U0053>"
+<U0422> "<U0054>"
+<U0423> "<U0055>"
+<U0412> "<U0056>"
+<U0417> "<U005A>"
+<U0416> "<U017D>";"<U005A>" % z<
+<U0428> "<U0160>";"<U0053>" % s<
+<U0427> "<U010C>";"<U0063>" % c<
+
+translit_end
+END LC_CTYPE
+
+
+LC_COLLATE
+
+copy "iso14651_t1"
+
+collating-symbol  <d-z-sh>
+collating-symbol  <l-j-sh>
+collating-symbol  <n-j-sh>
+
+collating-symbol <cacute>
+collating-symbol <ccaron>
+collating-symbol <d//>
+collating-symbol <scaron>
+collating-symbol <zcaron>
+
+collating-symbol <CAP-MIN>
+collating-symbol <MIN-CAP>
+
+reorder-after <MIN>
+<MIN-CAP>
+reorder-after <CAP>
+<CAP-MIN>
+
+reorder-after <c>
+<cacute>
+<ccaron>
+<d>
+<d-z-sh>
+<d//>
+reorder-after <l>
+<l-j-sh>
+reorder-after <n>
+<n-j-sh>
+reorder-after <s>
+<scaron>
+reorder-after <z>
+<zcaron>
+
+reorder-after <U0063>
+<U0107>	<cacute>;<PCT>;<MIN>;IGNORE
+<U010D>	<ccaron>;<PCT>;<MIN>;IGNORE
+reorder-after <U0043>
+<U0106>	<cacute>;<PCT>;<CAP>;IGNORE
+<U010C>	<ccaron>;<PCT>;<CAP>;IGNORE
+
+reorder-after <U0064>
+<d-z<>	<d-z-sh>;<PCT>;<MIN>;IGNORE
+<dz<>	<d-z-sh>;<PCT>;<MIN>;IGNORE
+<d-Z<>	<d-z-sh>;<PCT>;<MIN-CAP>;IGNORE
+<U0111>	<d//>;<PCT>;<MIN>;IGNORE
+reorder-after <U0044>
+<D-Z<>	<d-z-sh>;<PCT>;<CAP>;IGNORE
+<DZ<>	<d-z-sh>;<PCT>;<CAP>;IGNORE
+<D-z<>	<d-z-sh>;<PCT>;<CAP-MIN>;IGNORE
+<Dz<>	<d-z-sh>;<PCT>;<CAP-MIN>;IGNORE
+<U0110>	<d//>;<PCT>;<CAP>;IGNORE
+
+reorder-after <U006C>
+<l-j>	<l-j-sh>;<PCT>;<MIN>;IGNORE
+<lj>	<l-j-sh>;<PCT>;<MIN>;IGNORE
+<l-J>	<l-j-sh>;<PCT>;<MIN-CAP>;IGNORE
+reorder-after <U004C>
+<L-J>	<l-j-sh>;<PCT>;<CAP>;IGNORE
+<LJ>	<l-j-sh>;<PCT>;<CAP>;IGNORE
+<L-j>	<l-j-sh>;<PCT>;<CAP-MIN>;IGNORE
+<Lj>	<l-j-sh>;<PCT>;<CAP-MIN>;IGNORE
+
+reorder-after <U006E>
+<n-j>	<n-j-sh>;<PCT>;<MIN>;IGNORE
+<nj>	<n-j-sh>;<PCT>;<MIN>;IGNORE
+<n-J>	<n-j-sh>;<PCT>;<MIN-CAP>;IGNORE
+reorder-after <U004E>
+<N-J>	<n-j-sh>;<PCT>;<CAP>;IGNORE
+<NJ>	<n-j-sh>;<PCT>;<CAP>;IGNORE
+<N-j>	<n-j-sh>;<PCT>;<CAP-MIN>;IGNORE
+<Nj>	<n-j-sh>;<PCT>;<CAP-MIN>;IGNORE
+
+reorder-after <U0073>
+<U0161>	<scaron>;<PCT>;<MIN>;IGNORE
+reorder-after <U0053>
+<U0160>	<scaron>;<PCT>;<CAP>;IGNORE
+
+reorder-after <U007A>
+<U017E>	<zcaron>;<PCT>;<MIN>;IGNORE
+reorder-after <U005A>
+<U017D>	<zcaron>;<PCT>;<CAP>;IGNORE
+
+reorder-end
+
+END LC_COLLATE
+
+LC_MONETARY
+int_curr_symbol           "<U0043><U0053><U0044><U0020>"
+currency_symbol           "<U0434><U0438><U043D>"
+mon_decimal_point         "<U002C>"
+mon_thousands_sep         "<U002E>"
+mon_grouping              3;3
+positive_sign             ""
+negative_sign             "<U002D>"
+int_frac_digits           2
+frac_digits               2
+p_cs_precedes             0
+p_sep_by_space            1
+n_cs_precedes             0
+n_sep_by_space            1
+p_sign_posn               1
+n_sign_posn               1
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point             "<U002C>"
+thousands_sep             ""
+grouping                  0;0
+END LC_NUMERIC
+
+LC_TIME
+
+abday   "<U043D><U0435><U0434>";"<U043F><U043E><U043D>";/
+        "<U0443><U0442><U043E>";"<U0441><U0440><U0435>";/
+        "<U0447><U0435><U0442>";"<U043F><U0435><U0442>";/
+        "<U0441><U0443><U0431>"
+day     "<U043D><U0435><U0434><U0435><U0459><U0430>";/
+        "<U043F><U043E><U043D><U0435><U0434><U0435><U0459><U0430><U043A>";/
+        "<U0443><U0442><U043E><U0440><U0430><U043A>";/
+        "<U0441><U0440><U0435><U0434><U0430>";/
+        "<U0447><U0435><U0442><U0432><U0440><U0442><U0430><U043A>";/
+        "<U043F><U0435><U0442><U0430><U043A>";/
+        "<U0441><U0443><U0431><U043E><U0442><U0430>"
+abmon   "<U0458><U0430><U043D>";"<U0444><U0435><U0431>";/
+        "<U043C><U0430><U0440>";"<U0430><U043F><U0440>";/
+        "<U043C><U0430><U0458>";"<U0458><U0443><U043D>";/
+        "<U0458><U0443><U043B>";"<U0430><U0432><U0433>";/
+        "<U0441><U0435><U043F>";"<U043E><U043A><U0442>";/
+        "<U043D><U043E><U0432>";"<U0434><U0435><U0446>"
+mon     "<U0458><U0430><U043D><U0443><U0430><U0440>";/
+        "<U0444><U0435><U0431><U0440><U0443><U0430><U0440>";/
+        "<U043C><U0430><U0440><U0442>";/
+        "<U0430><U043F><U0440><U0438><U043B>";/
+        "<U043C><U0430><U0458>";/
+        "<U0458><U0443><U043D>";/
+        "<U0458><U0443><U043B>";/
+        "<U0430><U0432><U0433><U0443><U0441><U0442>";/
+        "<U0441><U0435><U043F><U0442><U0435><U043C><U0431><U0430><U0440>";/
+        "<U043E><U043A><U0442><U043E><U0431><U0430><U0440>";/
+        "<U043D><U043E><U0432><U0435><U043C><U0431><U0430><U0440>";/
+        "<U0434><U0435><U0446><U0435><U043C><U0431><U0430><U0440>"
+
+d_t_fmt "<U0025><U0041><U002C><U0020><U0025><U0064><U002E><U0020>/
+<U0025><U0042><U0020><U0025><U0059><U002E><U0020><U0025><U0054>/
+<U0020><U0025><U005A>"
+d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059><U002E>"
+t_fmt   "<U0025><U0054>"
+am_pm   "";""
+t_fmt_ampm "<U0025><U0054>"
+date_fmt  "<U0025><U0061><U002C><U0020><U0025><U0065><U002E><U0020>/
+<U0025><U0062><U0020><U0025><U0059><U002E><U0020><U0020><U0025><U0048>/
+<U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U000A>"
+week    7;19971201;4
+first_weekday 2
+first_workday 2
+END LC_TIME
+
+LC_MESSAGES
+yesexpr "<U005E><U005B><U0414><U0434><U0044><U0064><U0059><U0079><U005D>"
+noexpr  "<U005E><U005B><U041D><U043D><U004E><U006E><U005D>"
+END LC_MESSAGES
+
+LC_PAPER
+height   297
+width    210
+END LC_PAPER
+
+LC_NAME
+name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+name_gen    ""
+name_mr     "<U0433><U002D><U0434><U0438><U043D>"
+name_mrs    "<U0433><U002D><U0452><U0430>"
+name_miss   "<U0433><U002D><U0452><U0438><U0446><U0430>"
+name_ms     "<U0433><U002D><U0452><U0430>"
+END LC_NAME
+
+LC_ADDRESS
+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><U0053>"
+country_ab3   "<U0053><U0043><U0047>"
+% FIXME: country_post is probably incorrect
+country_post  "<U0053><U0043><U0047>"
+country_name  "<U0421><U0440><U0431><U0438><U0458><U0430><U0020><U0438>/
+<U0020><U0426><U0440><U043D><U0430><U0020><U0413><U043E><U0440><U0430>"
+country_num   891
+country_car   "<U0053><U0043><U0047>"
+% FIXME: ISBN code is what? "86" that preceedes all the numbers?
+country_isbn  "<U0038><U0036>"
+lang_name     "<U0441><U0440><U043F><U0441><U043A><U0438>"
+lang_term     "<U0073><U0072><U0070>"
+lang_lib      "<U0073><U0063><U0063>"
+lang_ab	      "<U0073><U0072>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+tel_int_fmt    "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
+<U006C>"
+tel_dom_fmt    "<U0025><U0041><U0020><U0025><U006C>"
+int_prefix     "<U0033><U0038><U0031>"
+int_select     "<U0039><U0039>"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+measurement    1
+END LC_MEASUREMENT
diff --git a/malloc/Makefile b/malloc/Makefile
index 0512c49839..45e8f59ab4 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -101,6 +101,8 @@ $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
 
 include ../Rules
 
+CFLAGS-mcheck-init.c = $(PIC-ccflag)
+
 $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
 	-rm -f $@
 	$(patsubst %/,cd % &&,$(objpfx)) \
diff --git a/malloc/malloc.c b/malloc/malloc.c
index e3ccbde7b5..35ec8d6a56 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3766,6 +3766,8 @@ public_mTRIm(size_t s)
 {
   int result;
 
+  if(__malloc_initialized < 0)
+    ptmalloc_init ();
   (void)mutex_lock(&main_arena.mutex);
   result = mTRIm(s);
   (void)mutex_unlock(&main_arena.mutex);
diff --git a/manual/string.texi b/manual/string.texi
index 21ab71461a..84ac439a3f 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -386,7 +386,7 @@ memcpy (new, old, arraysize * sizeof (struct foo));
 
 @comment wchar.h
 @comment ISO
-@deftypefun {wchar_t *} wmemcpy (wchar_t *restrict @var{wto}, const wchar_t *restruct @var{wfrom}, size_t @var{size})
+@deftypefun {wchar_t *} wmemcpy (wchar_t *restrict @var{wto}, const wchar_t *restrict @var{wfrom}, size_t @var{size})
 The @code{wmemcpy} function copies @var{size} wide characters from the object
 beginning at @var{wfrom} into the object beginning at @var{wto}.  The
 behavior of this function is undefined if the two arrays @var{wto} and
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index b9e27ab48c..0ad2213387 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -92,9 +92,13 @@ nis_removemember (const_nis_name member, const_nis_name group)
       /* This realloc() call always decreases the size.  This cannot
 	 fail.  We still have the test but do not recover memory
 	 (i.e., we overwrite the input pointer).  */
-      newmem = realloc (newmem, k * sizeof (char*));
-      if (newmem == NULL)
-	return NIS_NOMEMORY;
+      nis_name *newp = realloc (newmem, k * sizeof (char*));
+      if (newp == NULL)
+	{
+	  free (newmem);
+	  return NIS_NOMEMORY;
+	}
+      newmem = newp;
 
       NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val = newmem;
       NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len = k;
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 13acdfdf50..f746b7c629 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -94,9 +94,10 @@ __create_ib_request (const_nis_name name, unsigned int flags)
       if ((search_len + 1) >= size)
         {
           size += 1;
-          search_val = realloc (search_val, size * sizeof (nis_attr));
-	  if (search_val == NULL)
+	  nis_attr *newp = realloc (search_val, size * sizeof (nis_attr));
+	  if (newp == NULL)
 	    goto free_null;
+	  search_val = newp;
 	}
       search_val[search_len].zattr_ndx = strdup (key);
       if ((search_val[search_len].zattr_ndx) == NULL)
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 08bf5d2f80..ae009bc966 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -229,9 +229,10 @@ getgrnam_plusgroup (const char *name, struct group *result, ent_t *ent,
   if (!nss_getgrnam_r)
     return NSS_STATUS_UNAVAIL;
 
-  if (nss_getgrnam_r (name, result, buffer, buflen, errnop) !=
-      NSS_STATUS_SUCCESS)
-    return NSS_STATUS_NOTFOUND;
+  enum nss_status status = nss_getgrnam_r (name, result, buffer, buflen,
+					   errnop);
+  if (status != NSS_STATUS_SUCCESS)
+    return status;
 
   if (in_blacklist (result->gr_name, strlen (result->gr_name), ent))
     return NSS_STATUS_NOTFOUND;
@@ -551,7 +552,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
 	     !(parse_res = _nss_files_parse_grent (p, result, data, buflen,
 						   errnop)));
 
-      if (parse_res == -1)
+      if (__builtin_expect (parse_res == -1, 0))
 	/* The parser ran out of space.  */
 	goto erange_reset;
 
@@ -589,9 +590,11 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
       /* +:... */
       if (result->gr_name[0] == '+' && result->gr_name[1] == '\0')
 	{
-	  enum nss_status status;
+	  if (!nss_getgrgid_r)
+	    return NSS_STATUS_UNAVAIL;
 
-	  status = nss_getgrgid_r (gid, result, buffer, buflen, errnop);
+	  enum nss_status status = nss_getgrgid_r (gid, result, buffer, buflen,
+						   errnop);
 	  if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
 	    return NSS_STATUS_NOTFOUND;
 	  else
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index 89a6a7013e..bf6014bf53 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -453,29 +453,27 @@ static enum nss_status
 getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent,
 		   char *buffer, size_t buflen, int *errnop)
 {
-  struct passwd pwd;
-  char *p;
-  size_t plen;
-
   if (!nss_getpwnam_r)
     return NSS_STATUS_UNAVAIL;
 
+  struct passwd pwd;
   memset (&pwd, '\0', sizeof (struct passwd));
 
   copy_pwd_changes (&pwd, result, NULL, 0);
 
-  plen = pwd_need_buflen (&pwd);
+  size_t plen = pwd_need_buflen (&pwd);
   if (plen > buflen)
     {
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  p = buffer + (buflen - plen);
+  char *p = buffer + (buflen - plen);
   buflen -= plen;
 
-  if (nss_getpwnam_r (name, result, buffer, buflen, errnop) !=
-      NSS_STATUS_SUCCESS)
-    return NSS_STATUS_NOTFOUND;
+  enum nss_status status = nss_getpwnam_r (name, result, buffer, buflen,
+					   errnop);
+  if (status != NSS_STATUS_SUCCESS)
+    return status;
 
   if (in_blacklist (result->pw_name, strlen (result->pw_name), ent))
     return NSS_STATUS_NOTFOUND;
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 4ca6368139..1645316013 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -401,13 +401,10 @@ static enum nss_status
 getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
 		   char *buffer, size_t buflen, int *errnop)
 {
-  struct spwd pwd;
-  char *p;
-  size_t plen;
-
   if (!nss_getspnam_r)
     return NSS_STATUS_UNAVAIL;
 
+  struct spwd pwd;
   memset (&pwd, '\0', sizeof (struct spwd));
   pwd.sp_warn = -1;
   pwd.sp_inact = -1;
@@ -416,18 +413,19 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
 
   copy_spwd_changes (&pwd, result, NULL, 0);
 
-  plen = spwd_need_buflen (&pwd);
+  size_t plen = spwd_need_buflen (&pwd);
   if (plen > buflen)
     {
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  p = buffer + (buflen - plen);
+  char *p = buffer + (buflen - plen);
   buflen -= plen;
 
-  if (nss_getspnam_r (name, result, buffer, buflen, errnop) !=
-      NSS_STATUS_SUCCESS)
-    return NSS_STATUS_NOTFOUND;
+  enum nss_status status = nss_getspnam_r (name, result, buffer, buflen,
+					   errnop);
+  if (status != NSS_STATUS_SUCCESS)
+    return status;
 
   if (in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
     return NSS_STATUS_NOTFOUND;
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 370b69a074..13ae7372bc 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,39 @@
+2005-07-11  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1102]
+	* sysdeps/pthread/pthread.h (PTHREAD_MUTEX_INITIALIZER,
+	PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
+	PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP,
+	PTHREAD_MUTEX_ADAPTIVE_NP, PTHREAD_RWLOCK_INITIALIZER,
+	PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+	PTHREAD_COND_INITIALIZER): Supply zeros for all fields
+	in the structure.
+	* Makefile (tests): Add tst-initializers1.
+	(CFLAGS-tst-initializers1.c): Set.
+	* tst-initializers1.c: New test.
+
+2005-05-03  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #915]
+	* sysdeps/pthread/pthread.h: Avoid empty initializers.
+
+2005-04-27  Ulrich Drepper  <drepper@redhat.com>
+
+	* tst-cancel17.c (do_test): Add arbitrary factor to make sure
+	aio_write blocks.
+
+2005-04-05  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1102]
+	* sysdeps/pthread/pthread.h (__pthread_cleanup_routine): Use
+	__inline instead of inline.
+	* sysdeps/pthread/bits/libc-lock.h (__libc_cleanup_routine): Likewise.
+
+2005-03-23  Ulrich Drepper  <drepper@redhat.com>
+
+	* pthread_create.c (__pthread_create_2_1): Rename syscall error
+	variable to scerr.
+
 2005-02-25  Roland McGrath  <roland@redhat.com>
 
 	* alloca_cutoff.c: Correct license text.
@@ -111,7 +147,7 @@
 	* sysdeps/pthread/posix-timer.h (__timer_signal_thread_pclk,
 	__timer_signal_thread_tclk): Remove.
 	* sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Removed.
-	* sysdeps/unix/sysv/linux/ia64/bits/posix_>opt.h: Removed.
+	* sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h: Removed.
 	* sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h: Removed.
 
 2004-12-07  Jakub Jelinek  <jakub@redhat.com>
diff --git a/nptl/Makefile b/nptl/Makefile
index 8d18946e6f..d4dc88a732 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -241,7 +241,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
 	tst-backtrace1 \
 	tst-oddstacklimit \
 	tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
-	tst-getpid1 tst-getpid2
+	tst-getpid1 tst-getpid2 tst-initializers1
 xtests = tst-setuid1 tst-setuid1-static
 
 # Files which must not be linked with libpthread.
@@ -410,6 +410,7 @@ CFLAGS-tst-cleanupx4.c += -fexceptions
 CFLAGS-tst-oncex3.c += -fexceptions
 CFLAGS-tst-oncex4.c += -fexceptions
 CFLAGS-tst-align.c += $(stack-align-test-flags)
+CFLAGS-tst-initializers1.c += -W -Wall -Werror
 
 tst-cancel7-ARGS = --command "$(built-program-cmd)"
 tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index bf41e9fcc9..b88ab14e16 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -406,14 +406,14 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
       && __builtin_expect ((iattr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0, 0)
       && (iattr->flags & (ATTR_FLAG_SCHED_SET | ATTR_FLAG_POLICY_SET)) != 0)
     {
-      INTERNAL_SYSCALL_DECL (err);
+      INTERNAL_SYSCALL_DECL (scerr);
 
       /* Use the scheduling parameters the user provided.  */
       if (iattr->flags & ATTR_FLAG_POLICY_SET)
 	pd->schedpolicy = iattr->schedpolicy;
       else if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0)
 	{
-	  pd->schedpolicy = INTERNAL_SYSCALL (sched_getscheduler, err, 1, 0);
+	  pd->schedpolicy = INTERNAL_SYSCALL (sched_getscheduler, scerr, 1, 0);
 	  pd->flags |= ATTR_FLAG_POLICY_SET;
 	}
 
@@ -422,14 +422,14 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
 		sizeof (struct sched_param));
       else if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0)
 	{
-	  INTERNAL_SYSCALL (sched_getparam, err, 2, 0, &pd->schedparam);
+	  INTERNAL_SYSCALL (sched_getparam, scerr, 2, 0, &pd->schedparam);
 	  pd->flags |= ATTR_FLAG_SCHED_SET;
 	}
 
       /* Check for valid priorities.  */
-      int minprio = INTERNAL_SYSCALL (sched_get_priority_min, err, 1,
+      int minprio = INTERNAL_SYSCALL (sched_get_priority_min, scerr, 1,
 				      iattr->schedpolicy);
-      int maxprio = INTERNAL_SYSCALL (sched_get_priority_max, err, 1,
+      int maxprio = INTERNAL_SYSCALL (sched_get_priority_max, scerr, 1,
 				      iattr->schedpolicy);
       if (pd->schedparam.sched_priority < minprio
 	  || pd->schedparam.sched_priority > maxprio)
diff --git a/nptl/sysdeps/pthread/bits/libc-lock.h b/nptl/sysdeps/pthread/bits/libc-lock.h
index 8310092e7e..3a51ab0dcc 100644
--- a/nptl/sysdeps/pthread/bits/libc-lock.h
+++ b/nptl/sysdeps/pthread/bits/libc-lock.h
@@ -408,7 +408,7 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer
 
 
 /* Normal cleanup handling, based on C cleanup attribute.  */
-extern inline void
+extern __inline void
 __libc_cleanup_routine (struct __pthread_cleanup_frame *f)
 {
   if (f->__do_it)
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index 57024e1e84..92e66f7c72 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -62,22 +62,22 @@ enum
 
 /* Mutex initializers.  */
 #define PTHREAD_MUTEX_INITIALIZER \
-  { }
+  { { 0, 0, 0, 0, 0, 0 } }
 #ifdef __USE_GNU
 # if __WORDSIZE == 64
 #  define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+  { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0 } }
 #  define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+  { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0 } }
 #  define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+  { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0 } }
 # else
 #  define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+  { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, 0 } }
 #  define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+  { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, 0 } }
 #  define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+  { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, 0 } }
 # endif
 #endif
 
@@ -93,8 +93,13 @@ enum
 };
 
 /* Read-write lock initializers.  */
-# define PTHREAD_RWLOCK_INITIALIZER \
-  { }
+# if __WORDSIZE == 64
+#  define PTHREAD_RWLOCK_INITIALIZER \
+  { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
+# else
+#  define PTHREAD_RWLOCK_INITIALIZER \
+  { { 0, 0, 0, 0, 0, 0, 0, 0 } }
+# endif
 # ifdef __USE_GNU
 #  if __WORDSIZE == 64
 #   define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
@@ -102,7 +107,7 @@ enum
       PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
 #  else
 #   define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
-  { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
+  { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0 } }
 #  endif
 # endif
 #endif  /* Unix98 or XOpen2K */
@@ -140,7 +145,7 @@ enum
 
 
 /* Conditional variable handling.  */
-#define PTHREAD_COND_INITIALIZER { }
+#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
 
 
 /* Cleanup buffers */
@@ -527,7 +532,7 @@ class __pthread_cleanup_class
    function the compiler is free to decide inlining the change when
    needed or fall back on the copy which must exist somewhere
    else.  */
-extern inline void
+extern __inline void
 __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
 {
   if (__frame->__do_it)
diff --git a/nptl/tst-cancel17.c b/nptl/tst-cancel17.c
index 9fb089ac83..269d141e4c 100644
--- a/nptl/tst-cancel17.c
+++ b/nptl/tst-cancel17.c
@@ -228,7 +228,7 @@ do_test (void)
 
   size_t len2 = fpathconf (fds[1], _PC_PIPE_BUF);
   size_t page_size = sysconf (_SC_PAGESIZE);
-  len2 = (len2 < page_size ? page_size : len2) + sizeof (mem) + 1;
+  len2 = 20 * (len2 < page_size ? page_size : len2) + sizeof (mem) + 1;
   char *mem2 = malloc (len2);
   if (mem2 == NULL)
     {
diff --git a/nptl/tst-initializers1.c b/nptl/tst-initializers1.c
new file mode 100644
index 0000000000..ccd27286e8
--- /dev/null
+++ b/nptl/tst-initializers1.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+
+pthread_mutex_t mtx_normal = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mtx_recursive = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+pthread_mutex_t mtx_errorchk = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+pthread_mutex_t mtx_adaptive = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
+pthread_rwlock_t rwl_normal = PTHREAD_RWLOCK_INITIALIZER;
+pthread_rwlock_t rwl_writer
+  = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+int
+main (void)
+{
+  if (mtx_normal.__data.__kind != PTHREAD_MUTEX_TIMED_NP)
+    return 1;
+  if (mtx_recursive.__data.__kind != PTHREAD_MUTEX_RECURSIVE_NP)
+    return 1;
+  if (mtx_errorchk.__data.__kind != PTHREAD_MUTEX_ERRORCHECK_NP)
+    return 1;
+  if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP)
+    return 1;
+  if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP)
+    return 1;
+  if (rwl_writer.__data.__flags
+      != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)
+    return 1;
+  return 0;
+}
diff --git a/nscd/Makefile b/nscd/Makefile
index 75a9d434f4..dcdd8b4894 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -53,8 +53,12 @@ endif
 
 all-nscd-modules := $(nscd-modules) selinux
 ifeq (yes,$(have-selinux))
+ifeq (yes,$(have-libaudit))
+libaudit = -laudit
+endif
+
 nscd-modules += selinux
-selinux-LIBS := -lselinux
+selinux-LIBS := -lselinux $(libaudit)
 endif
 
 LDLIBS-nscd = $(selinux-LIBS)
diff --git a/nscd/connections.c b/nscd/connections.c
index 897f4747de..7d0063aed0 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -621,7 +621,10 @@ send_ro_fd (struct database_dyn *db, char *key, int fd)
 
   /* Send the control message.  We repeat when we are interrupted but
      everything else is ignored.  */
-  (void) TEMP_FAILURE_RETRY (sendmsg (fd, &msg, 0));
+#ifndef MSG_NOSIGNAL
+# define MSG_NOSIGNAL 0
+#endif
+  (void) TEMP_FAILURE_RETRY (sendmsg (fd, &msg, MSG_NOSIGNAL));
 
   if (__builtin_expect (debug_level > 0, 0))
     dbg_log (_("provide access to FD %d, for %s"), db->ro_fd, key);
@@ -1173,8 +1176,7 @@ handle_request: request received (Version = %d)"), req.version);
 	  /* The pthread_cond_timedwait() call timed out.  It is time
 		 to clean up the cache.  */
 	  assert (my_number < lastdb);
-	  prune_cache (&dbs[my_number],
-		       prune_ts.tv_sec + (prune_ts.tv_nsec >= 500000000));
+	  prune_cache (&dbs[my_number], time (NULL));
 
 	  if (clock_gettime (timeout_clock, &prune_ts) == -1)
 	    /* Should never happen.  */
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 12c10664af..b7f0239a23 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -196,7 +196,10 @@ get_mapping (request_type type, const char *key,
     /* Failure or timeout.  */
     goto out_close2;
 
-  if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, 0)) != keylen)
+#ifndef MSG_NOSIGNAL
+# define MSG_NOSIGNAL 0
+#endif
+  if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, MSG_NOSIGNAL)) != keylen)
     goto out_close2;
 
   mapfd = *(int *) CMSG_DATA (cmsg);
diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c
index 9231642278..a595a0b88f 100644
--- a/nscd/nscd_stat.c
+++ b/nscd/nscd_stat.c
@@ -143,8 +143,8 @@ receive_print_stats (void)
   int fd;
   int i;
   uid_t uid = getuid ();
-  const char *yesstr = nl_langinfo (YESSTR);
-  const char *nostr = nl_langinfo (NOSTR);
+  const char *yesstr = _("yes");
+  const char *nostr = _("no");
 
   /* Find out whether there is another user but root allowed to
      request statistics.  */
diff --git a/nscd/selinux.c b/nscd/selinux.c
index f57f0920ae..4dc4df3648 100644
--- a/nscd/selinux.c
+++ b/nscd/selinux.c
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include "config.h"
 #include <error.h>
 #include <errno.h>
 #include <libintl.h>
@@ -30,6 +31,9 @@
 #include <selinux/avc.h>
 #include <selinux/flask.h>
 #include <selinux/selinux.h>
+#ifdef HAVE_LIBAUDIT
+#include <libaudit.h>
+#endif
 
 #include "dbg_log.h"
 #include "selinux.h"
@@ -66,6 +70,11 @@ static struct avc_entry_ref aeref;
 /* Thread to listen for SELinux status changes via netlink.  */
 static pthread_t avc_notify_thread;
 
+#ifdef HAVE_LIBAUDIT
+/* Prototype for supporting the audit daemon */
+static void log_callback (const char *fmt, ...);
+#endif
+
 /* Prototypes for AVC callback functions.  */
 static void *avc_create_thread (void (*run) (void));
 static void avc_stop_thread (void *thread);
@@ -77,7 +86,11 @@ static void avc_free_lock (void *lock);
 /* AVC callback structures for use in avc_init.  */
 static const struct avc_log_callback log_cb =
 {
+#ifdef HAVE_LIBAUDIT
+  .func_log = log_callback,
+#else
   .func_log = dbg_log,
+#endif
   .func_audit = NULL
 };
 static const struct avc_thread_callback thread_cb =
@@ -93,6 +106,30 @@ static const struct avc_lock_callback lock_cb =
   .func_free_lock = avc_free_lock
 };
 
+#ifdef HAVE_LIBAUDIT
+/* The audit system's netlink socket descriptor */
+static int audit_fd = -1;
+
+/* When an avc denial occurs, log it to audit system */
+static void 
+log_callback (const char *fmt, ...)
+{
+  va_list ap;
+
+  va_start (ap, fmt);
+  audit_log_avc (audit_fd, AUDIT_USER_AVC, fmt, ap);
+  va_end (ap);
+}
+
+/* Initialize the connection to the audit system */
+static void 
+audit_init (void)
+{
+  audit_fd = audit_open ();
+  if (audit_fd < 0)
+     dbg_log (_("Failed opening connection to the audit subsystem"));
+}
+#endif /* HAVE_LIBAUDIT */
 
 /* Determine if we are running on an SELinux kernel. Set selinux_enabled
    to the result.  */
@@ -182,6 +219,9 @@ nscd_avc_init (void)
     error (EXIT_FAILURE, errno, _("Failed to start AVC"));
   else
     dbg_log (_("Access Vector Cache (AVC) started"));
+#ifdef HAVE_LIBAUDIT
+  audit_init ();
+#endif
 }
 
 
@@ -262,6 +302,9 @@ void
 nscd_avc_destroy (void)
 {
   avc_destroy ();
+#ifdef HAVE_LIBAUDIT
+  audit_close (audit_fd);
+#endif
 }
 
 #endif /* HAVE_SELINUX */
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index e409ed7300..3fa7c322d1 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -327,31 +327,74 @@ fnmatch (pattern, string, flags)
     {
       mbstate_t ps;
       size_t n;
+      const char *p;
       wchar_t *wpattern;
       wchar_t *wstring;
 
       /* Convert the strings into wide characters.  */
       memset (&ps, '\0', sizeof (ps));
-      n = mbsrtowcs (NULL, &pattern, 0, &ps);
-      if (__builtin_expect (n == (size_t) -1, 0))
-	/* Something wrong.
-	   XXX Do we have to set `errno' to something which mbsrtows hasn't
-	   already done?  */
-	return -1;
-      wpattern = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
-      assert (mbsinit (&ps));
-      (void) mbsrtowcs (wpattern, &pattern, n + 1, &ps);
+      p = pattern;
+#ifdef _LIBC
+      n = strnlen (pattern, 1024);
+#else
+      n = strlen (pattern);
+#endif
+      if (__builtin_expect (n < 1024, 1))
+	{
+	  wpattern = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	  n = mbsrtowcs (wpattern, &p, n + 1, &ps);
+	  if (__builtin_expect (n == (size_t) -1, 0))
+	    /* Something wrong.
+	       XXX Do we have to set `errno' to something which mbsrtows hasn't
+	       already done?  */
+	    return -1;
+	  if (p)
+	    memset (&ps, '\0', sizeof (ps));
+	}
+      if (__builtin_expect (p != NULL, 0))
+	{
+	  n = mbsrtowcs (NULL, &pattern, 0, &ps);
+	  if (__builtin_expect (n == (size_t) -1, 0))
+	    /* Something wrong.
+	       XXX Do we have to set `errno' to something which mbsrtows hasn't
+	       already done?  */
+	    return -1;
+	  wpattern = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	  assert (mbsinit (&ps));
+	  (void) mbsrtowcs (wpattern, &pattern, n + 1, &ps);
+	}
 
       assert (mbsinit (&ps));
-      n = mbsrtowcs (NULL, &string, 0, &ps);
-      if (__builtin_expect (n == (size_t) -1, 0))
-	/* Something wrong.
-	   XXX Do we have to set `errno' to something which mbsrtows hasn't
-	   already done?  */
-	return -1;
-      wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
-      assert (mbsinit (&ps));
-      (void) mbsrtowcs (wstring, &string, n + 1, &ps);
+#ifdef _LIBC
+      n = strnlen (string, 1024);
+#else
+      n = strlen (string);
+#endif
+      p = string;
+      if (__builtin_expect (n < 1024, 1))
+	{
+	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	  n = mbsrtowcs (wstring, &p, n + 1, &ps);
+	  if (__builtin_expect (n == (size_t) -1, 0))
+	    /* Something wrong.
+	       XXX Do we have to set `errno' to something which mbsrtows hasn't
+	       already done?  */
+	    return -1;
+	  if (p)
+	    memset (&ps, '\0', sizeof (ps));
+	}
+      if (__builtin_expect (p != NULL, 0))
+	{
+	  n = mbsrtowcs (NULL, &string, 0, &ps);
+	  if (__builtin_expect (n == (size_t) -1, 0))
+	    /* Something wrong.
+	       XXX Do we have to set `errno' to something which mbsrtows hasn't
+	       already done?  */
+	    return -1;
+	  wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+	  assert (mbsinit (&ps));
+	  (void) mbsrtowcs (wstring, &string, n + 1, &ps);
+	}
 
       return internal_fnwmatch (wpattern, wstring, wstring + n,
 				flags & FNM_PERIOD, flags);
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 72bf187b14..2100bb5420 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -779,6 +779,8 @@ re_compile_internal (preg, pattern, length, syntax)
     }
   preg->used = sizeof (re_dfa_t);
 
+  __libc_lock_init (dfa->lock);
+
   err = init_dfa (dfa, length);
   if (BE (err != REG_NOERROR, 0))
     {
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index 001b50b134..d590104fce 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -214,7 +214,8 @@ build_wcs_buffer (pstr)
      re_string_t *pstr;
 {
 #ifdef _LIBC
-  unsigned char buf[pstr->mb_cur_max];
+  unsigned char buf[MB_LEN_MAX];
+  assert (MB_LEN_MAX >= pstr->mb_cur_max);
 #else
   unsigned char buf[64];
 #endif
@@ -282,7 +283,8 @@ build_wcs_upper_buffer (pstr)
   mbstate_t prev_st;
   int src_idx, byte_idx, end_idx, mbclen, remain_len;
 #ifdef _LIBC
-  unsigned char buf[pstr->mb_cur_max];
+  unsigned char buf[MB_LEN_MAX];
+  assert (MB_LEN_MAX >= pstr->mb_cur_max);
 #else
   unsigned char buf[64];
 #endif
diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index 18865a7266..e48627766f 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -39,6 +39,14 @@
 #if defined HAVE_WCTYPE_H || defined _LIBC
 # include <wctype.h>
 #endif /* HAVE_WCTYPE_H || _LIBC */
+#if defined _LIBC
+# include <bits/libc-lock.h>
+#else
+# define __libc_lock_define(CLASS,NAME)
+# define __libc_lock_init(NAME) do { } while (0)
+# define __libc_lock_lock(NAME) do { } while (0)
+# define __libc_lock_unlock(NAME) do { } while (0)
+#endif
 
 /* In case that the system doesn't have isblank().  */
 #if !defined _LIBC && !defined HAVE_ISBLANK && !defined isblank
@@ -650,6 +658,7 @@ struct re_dfa_t
 #ifdef DEBUG
   char* re_str;
 #endif
+  __libc_lock_define (, lock)
 };
 
 #ifndef RE_NO_INTERNAL_PROTOTYPES
diff --git a/posix/regexec.c b/posix/regexec.c
index 91b48dd4a2..021fcf4060 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -219,6 +219,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
 {
   reg_errcode_t err;
   int start, length;
+  re_dfa_t *dfa = (re_dfa_t *)preg->buffer;
 
   if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
     return REG_BADPAT;
@@ -233,12 +234,15 @@ regexec (preg, string, nmatch, pmatch, eflags)
       start = 0;
       length = strlen (string);
     }
+
+  __libc_lock_lock (dfa->lock);
   if (preg->no_sub)
     err = re_search_internal (preg, string, length, start, length - start,
 			      length, 0, NULL, eflags);
   else
     err = re_search_internal (preg, string, length, start, length - start,
 			      length, nmatch, pmatch, eflags);
+  __libc_lock_unlock (dfa->lock);
   return err != REG_NOERROR;
 }
 
@@ -402,6 +406,7 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
   regmatch_t *pmatch;
   int nregs, rval;
   int eflags = 0;
+  re_dfa_t *dfa = (re_dfa_t *)bufp->buffer;
 
   /* Check for out-of-range.  */
   if (BE (start < 0 || start > length, 0))
@@ -411,6 +416,8 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
   else if (BE (start + range < 0, 0))
     range = -start;
 
+  __libc_lock_lock (dfa->lock);
+
   eflags |= (bufp->not_bol) ? REG_NOTBOL : 0;
   eflags |= (bufp->not_eol) ? REG_NOTEOL : 0;
 
@@ -439,7 +446,10 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
     nregs = bufp->re_nsub + 1;
   pmatch = re_malloc (regmatch_t, nregs);
   if (BE (pmatch == NULL, 0))
-    return -2;
+    {
+      rval = -2;
+      goto out;
+    }
 
   result = re_search_internal (bufp, string, length, start, range, stop,
 			       nregs, pmatch, eflags);
@@ -469,6 +479,8 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
 	rval = pmatch[0].rm_so;
     }
   re_free (pmatch);
+ out:
+  __libc_lock_unlock (dfa->lock);
   return rval;
 }
 
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index 8b7767bd4a..a265719d36 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -20,7 +20,7 @@
 #include <stdio.h>
 #include <pwd.h>
 
-#define _S(x)	x ? x : ""
+#define _S(x)	x ?: ""
 
 /* Write an entry to the given stream.
    This must know the format of the password file.  */
@@ -35,11 +35,21 @@ putpwent (p, stream)
       return -1;
     }
 
-  if (fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
-	       p->pw_name, _S (p->pw_passwd),
-	       (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
-	       _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
-    return -1;
-
+  if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
+    {
+      if (fprintf (stream, "%s:%s:::%s:%s:%s\n",
+		   p->pw_name, _S (p->pw_passwd),
+		   _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
+	return -1;
+    }
+  else
+    {
+      if (fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+		   p->pw_name, _S (p->pw_passwd),
+		   (unsigned long int) p->pw_uid,
+		   (unsigned long int) p->pw_gid,
+		   _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
+	return -1;
+    }
   return 0;
 }
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index c641d2d371..b95c40b84b 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1602,6 +1602,8 @@ _IO_vfscanf (s, format, argptr, errp)
 	  if (c == EOF)
 	    input_error ();
 
+	  got_dot = got_e = 0;
+
 	  /* Check for a sign.  */
 	  if (c == L_('-') || c == L_('+'))
 	    {
@@ -1629,14 +1631,13 @@ _IO_vfscanf (s, format, argptr, errp)
 		  const char *cmpp = decimal;
 		  int avail = width > 0 ? width : INT_MAX;
 
-		  while ((unsigned char) *cmpp == c && avail > 0)
+		  while ((unsigned char) *cmpp == c && avail-- > 0)
 		    if (*++cmpp == '\0')
 		      break;
 		    else
 		      {
 			if (inchar () == EOF)
 			  break;
-			--avail;
 		      }
 
 		  if (*cmpp != '\0')
@@ -1652,6 +1653,17 @@ _IO_vfscanf (s, format, argptr, errp)
 
 		      conv_error ();
 		    }
+		  else
+		    {
+                     /* Add all the characters.  */
+                     for (cmpp = decimal; *cmpp != '\0'; ++cmpp)
+                       ADDW ((unsigned char) *cmpp);
+                     if (width > 0)
+                       width = avail;
+                     got_dot = 1;
+
+		      c = inchar ();
+		    }
 		  if (width > 0)
 		    width = avail;
 #endif
@@ -1759,7 +1771,6 @@ _IO_vfscanf (s, format, argptr, errp)
 		}
 	    }
 
-	  got_dot = got_e = 0;
 	  do
 	    {
 	      if (ISDIGIT (c))
diff --git a/stdlib/random_r.c b/stdlib/random_r.c
index e955ea576a..404006f2cd 100644
--- a/stdlib/random_r.c
+++ b/stdlib/random_r.c
@@ -236,23 +236,20 @@ __initstate_r (seed, arg_state, n, buf)
      size_t n;
      struct random_data *buf;
 {
-  int type;
-  int degree;
-  int separation;
-  int32_t *state;
-  int old_type;
-  int32_t *old_state;
-
   if (buf == NULL)
     goto fail;
 
-  old_type = buf->rand_type;
-  old_state = buf->state;
-  if (old_type == TYPE_0)
-    old_state[-1] = TYPE_0;
-  else
-    old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+  int32_t *old_state = buf->state;
+  if (old_state != NULL)
+    {
+      int old_type = buf->rand_type;
+      if (old_type == TYPE_0)
+	old_state[-1] = TYPE_0;
+      else
+	old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+    }
 
+  int type;
   if (n >= BREAK_3)
     type = n < BREAK_4 ? TYPE_3 : TYPE_4;
   else if (n < BREAK_1)
@@ -267,13 +264,13 @@ __initstate_r (seed, arg_state, n, buf)
   else
     type = n < BREAK_2 ? TYPE_1 : TYPE_2;
 
-  degree = random_poly_info.degrees[type];
-  separation = random_poly_info.seps[type];
+  int degree = random_poly_info.degrees[type];
+  int separation = random_poly_info.seps[type];
 
   buf->rand_type = type;
   buf->rand_sep = separation;
   buf->rand_deg = degree;
-  state = &((int32_t *) arg_state)[1];	/* First location.  */
+  int32_t *state = &((int32_t *) arg_state)[1];	/* First location.  */
   /* Must set END_PTR before srandom.  */
   buf->end_ptr = &state[degree];
 
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 1bda32262b..cb19fcb03d 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -614,7 +614,7 @@ extern void *valloc (size_t __size) __THROW __attribute_malloc__;
 #ifdef __USE_XOPEN2K
 /* Allocate memory of SIZE bytes with an alignment of ALIGNMENT.  */
 extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
-     __THROW __attribute_malloc__ __nonnull ((1));
+     __THROW __nonnull ((1));
 #endif
 
 __BEGIN_NAMESPACE_STD
diff --git a/string/Makefile b/string/Makefile
index 66469f586e..7a77e35732 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -52,7 +52,7 @@ strop-tests	:= memchr memcmp memcpy memmove mempcpy memset memccpy	\
 tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
 		   tst-strlen stratcliff tst-svc tst-inlcall		\
 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\
-		   tst-strtok tst-strxfrm bug-strcoll1			\
+		   tst-strtok tst-strxfrm bug-strcoll1 tst-strfry	\
 		   $(addprefix test-,$(strop-tests))
 distribute	:= memcopy.h pagecopy.h tst-svc.expect test-string.h
 
diff --git a/string/tst-strfry.c b/string/tst-strfry.c
new file mode 100644
index 0000000000..2b40a39b13
--- /dev/null
+++ b/string/tst-strfry.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <string.h>
+
+static int
+do_test (void)
+{
+  char str[] = "this is a test";
+
+  strfry (str);
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index 284e355cc3..083ab676ab 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -85,6 +85,7 @@ all: # Make this the default target; it will be defined in Rules.
 
 include ../Makeconfig
 
+tests = tst-xdrmem
 xtests := tst-getmyaddr
 
 ifeq ($(have-thread-library),yes)
@@ -107,19 +108,19 @@ librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
 omit-deps = $(librpcsvc-routines)
 endif
 
-CFLAGS-xbootparam_prot.c = -Wno-unused
-CFLAGS-xnlm_prot.c = -Wno-unused
-CFLAGS-xrstat.c = -Wno-unused
-CFLAGS-xyppasswd.c = -Wno-unused
-CFLAGS-xklm_prot.c = -Wno-unused
-CFLAGS-xrex.c = -Wno-unused
-CFLAGS-xsm_inter.c = -Wno-unused
-CFLAGS-xmount.c = -Wno-unused
-CFLAGS-xrusers.c = -Wno-unused
-CFLAGS-xspray.c = -Wno-unused
-CFLAGS-xnfs_prot.c = -Wno-unused
-CFLAGS-xrquota.c = -Wno-unused
-CFLAGS-xkey_prot.c = -Wno-unused
+CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrstat.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xyppasswd.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xklm_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrex.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xsm_inter.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xmount.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrusers.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xspray.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xnfs_prot.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xrquota.c = -Wno-unused $(PIC-ccflag)
+CFLAGS-xkey_prot.c = -Wno-unused $(PIC-ccflag)
 CFLAGS-auth_unix.c = -fexceptions
 CFLAGS-key_call.c = -fexceptions
 CFLAGS-pmap_rmt.c = -fexceptions
diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c
index 374518716e..f58d3b2a8b 100644
--- a/sunrpc/bindrsvprt.c
+++ b/sunrpc/bindrsvprt.c
@@ -43,14 +43,15 @@
 int
 bindresvport (int sd, struct sockaddr_in *sin)
 {
-  int res;
   static short port;
   struct sockaddr_in myaddr;
   int i;
 
 #define STARTPORT 600
+#define LOWPORT 512
 #define ENDPORT (IPPORT_RESERVED - 1)
 #define NPORTS	(ENDPORT - STARTPORT + 1)
+  static short startport = STARTPORT;
 
   if (sin == (struct sockaddr_in *) 0)
     {
@@ -68,17 +69,29 @@ bindresvport (int sd, struct sockaddr_in *sin)
     {
       port = (__getpid () % NPORTS) + STARTPORT;
     }
-  res = -1;
-  __set_errno (EADDRINUSE);
 
-  for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; ++i)
+  /* Initialize to make gcc happy.  */
+  int res = -1;
+
+  int nports = ENDPORT - startport + 1;
+ again:
+  for (i = 0; i < nports; ++i)
     {
       sin->sin_port = htons (port++);
       if (port > ENDPORT)
 	{
-	  port = STARTPORT;
+	  port = startport;
 	}
       res = __bind (sd, sin, sizeof (struct sockaddr_in));
+      if (res >= 0 || errno != EADDRINUSE)
+	break;
+    }
+
+  if (i == nports && startport != LOWPORT)
+    {
+      startport = LOWPORT;
+      nports = STARTPORT - LOWPORT;
+      goto again;
     }
 
   return res;
diff --git a/sunrpc/pm_getmaps.c b/sunrpc/pm_getmaps.c
index d1d4ca8769..2a6876d9d8 100644
--- a/sunrpc/pm_getmaps.c
+++ b/sunrpc/pm_getmaps.c
@@ -44,9 +44,12 @@ static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
 #include <rpc/pmap_clnt.h>
 #include <sys/socket.h>
 #include <netdb.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <errno.h>
 #include <libintl.h>
+#include <unistd.h>
+
 
 /*
  * Get a copy of the current port maps.
@@ -56,13 +59,19 @@ struct pmaplist *
 pmap_getmaps (struct sockaddr_in *address)
 {
   struct pmaplist *head = (struct pmaplist *) NULL;
-  int socket = -1;
   struct timeval minutetimeout;
   CLIENT *client;
+  bool closeit = false;
 
   minutetimeout.tv_sec = 60;
   minutetimeout.tv_usec = 0;
   address->sin_port = htons (PMAPPORT);
+
+  /* Don't need a reserved port to get ports from the portmapper.  */
+  int socket = __get_socket (address);
+  if (socket != -1)
+    closeit = true;
+
   client = INTUSE(clnttcp_create) (address, PMAPPROG,
 				   PMAPVERS, &socket, 50, 500);
   if (client != (CLIENT *) NULL)
@@ -75,7 +84,9 @@ pmap_getmaps (struct sockaddr_in *address)
 	}
       CLNT_DESTROY (client);
     }
-  /* (void)close(socket); CLNT_DESTROY already closed it */
+  /* We only need to close the socket here if we opened  it.  */
+  if (closeit)
+    (void) __close (socket);
   address->sin_port = 0;
   return head;
 }
diff --git a/sunrpc/pm_getport.c b/sunrpc/pm_getport.c
index 00e1ba95bf..2d309841f3 100644
--- a/sunrpc/pm_getport.c
+++ b/sunrpc/pm_getport.c
@@ -38,6 +38,8 @@ static char sccsid[] = "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";
  * Copyright (C) 1984, Sun Microsystems, Inc.
  */
 
+#include <stdbool.h>
+#include <unistd.h>
 #include <rpc/rpc.h>
 #include <rpc/pmap_prot.h>
 #include <rpc/pmap_clnt.h>
@@ -49,6 +51,41 @@ static const struct timeval tottimeout =
 {60, 0};
 
 /*
+ * Create a socket that is locally bound to a non-reserve port. For
+ * any failures, -1 is returned which will cause the RPC code to
+ * create the socket.
+ */
+int
+internal_function
+__get_socket (struct sockaddr_in *saddr)
+{
+  int so = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+  if (so < 0)
+    return -1;
+
+  struct sockaddr_in laddr;
+  socklen_t namelen = sizeof (laddr);
+  laddr.sin_family = AF_INET;
+  laddr.sin_port = 0;
+  laddr.sin_addr.s_addr = htonl (INADDR_ANY);
+
+  int cc = __bind (so, (struct sockaddr *) &laddr, namelen);
+  if (__builtin_expect (cc < 0, 0))
+    {
+    fail:
+      __close (so);
+      return -1;
+    }
+
+  cc = __connect (so, (struct sockaddr *) saddr, namelen);
+  if (__builtin_expect (cc < 0, 0))
+    goto fail;
+
+  return so;
+}
+
+
+/*
  * Find the mapped port for program,version.
  * Calls the pmap service remotely to do the lookup.
  * Returns 0 if no map exists.
@@ -64,11 +101,18 @@ pmap_getport (address, program, version, protocol)
   int socket = -1;
   CLIENT *client;
   struct pmap parms;
+  bool closeit = false;
 
   address->sin_port = htons (PMAPPORT);
   if (protocol == IPPROTO_TCP)
-    client = INTUSE(clnttcp_create) (address, PMAPPROG, PMAPVERS, &socket,
-				     RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
+    {
+      /* Don't need a reserved port to get ports from the portmapper.  */
+      socket = __get_socket(address);
+      if (socket != -1)
+	closeit = true;
+      client = INTUSE(clnttcp_create) (address, PMAPPROG, PMAPVERS, &socket,
+				       RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
+    }
   else
     client = INTUSE(clntudp_bufcreate) (address, PMAPPROG, PMAPVERS, timeout,
 					&socket, RPCSMALLMSGSIZE,
@@ -93,7 +137,9 @@ pmap_getport (address, program, version, protocol)
 	}
       CLNT_DESTROY (client);
     }
-  /* (void)close(socket); CLNT_DESTROY already closed it */
+  /* We only need to close the socket here if we opened  it.  */
+  if (closeit)
+    (void) __close (socket);
   address->sin_port = 0;
   return port;
 }
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index 644d503a1f..e068848919 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -125,8 +125,9 @@ xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap)
       INTUSE(xdr_u_long) (xdrs, &(cap->vers)) &&
       INTUSE(xdr_u_long) (xdrs, &(cap->proc)))
     {
+      u_long dummy_arglen = 0;
       lenposition = XDR_GETPOS (xdrs);
-      if (!INTUSE(xdr_u_long) (xdrs, &(cap->arglen)))
+      if (!INTUSE(xdr_u_long) (xdrs, &dummy_arglen))
 	return FALSE;
       argposition = XDR_GETPOS (xdrs);
       if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr))
diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c
index fee83514d1..acc0132603 100644
--- a/sunrpc/rpc_main.c
+++ b/sunrpc/rpc_main.c
@@ -695,11 +695,9 @@ s_output (int argc, const char *argv[], const char *infile, const char *define,
 
   fprintf (fout, "#include <stdio.h>\n");
   fprintf (fout, "#include <stdlib.h>\n");
+  fprintf (fout, "#include <rpc/pmap_clnt.h>\n");
   if (Cflag)
-    {
-      fprintf (fout, "#include <rpc/pmap_clnt.h>\n");
-      fprintf (fout, "#include <string.h>\n");
-    }
+    fprintf (fout, "#include <string.h>\n");
   if (strcmp (svcclosetime, "-1") == 0)
     indefinitewait = 1;
   else if (strcmp (svcclosetime, "0") == 0)
diff --git a/sunrpc/tst-xdrmem.c b/sunrpc/tst-xdrmem.c
new file mode 100644
index 0000000000..0c9929c6ed
--- /dev/null
+++ b/sunrpc/tst-xdrmem.c
@@ -0,0 +1,205 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <rpc/rpc.h>
+
+static int
+do_test (void)
+{
+  XDR xdrs;
+  unsigned char buf[8192];
+  int v_int;
+  u_int v_u_int;
+  long v_long;
+  u_long v_u_long;
+  quad_t v_hyper;
+  u_quad_t v_u_hyper;
+  quad_t v_longlong_t;
+  u_quad_t v_u_longlong_t;
+  short v_short;
+  u_short v_u_short;
+  char v_char;
+  u_char v_u_char;
+  bool_t v_bool;
+  enum_t v_enum;
+  char *v_wrapstring;
+
+  xdrmem_create (&xdrs, (char *) buf, sizeof (buf), XDR_ENCODE);
+
+#define TESTS \
+  T(int, 0)				\
+  T(int, CHAR_MAX)			\
+  T(int, CHAR_MIN)			\
+  T(int, SHRT_MAX)			\
+  T(int, SHRT_MIN)			\
+  T(int, INT_MAX)			\
+  T(int, INT_MIN)			\
+  T(int, 0x123)				\
+  T(u_int, 0)				\
+  T(u_int, UCHAR_MAX)			\
+  T(u_int, USHRT_MAX)			\
+  T(u_int, UINT_MAX)			\
+  T(u_int, 0xdeadbeef)			\
+  T(u_int, 0x12345678)			\
+  T(long, 0)				\
+  T(long, 2147483647L)			\
+  T(long, -2147483648L)			\
+  T(long, -305419896L)			\
+  T(long, -305419896L)			\
+  T(u_long, 0)				\
+  T(u_long, 0xffffffffUL)		\
+  T(u_long, 0xdeadbeefUL)		\
+  T(u_long, 0x12345678UL)		\
+  T(hyper, 0)				\
+  T(hyper, CHAR_MAX)			\
+  T(hyper, CHAR_MIN)			\
+  T(hyper, SHRT_MAX)			\
+  T(hyper, SHRT_MIN)			\
+  T(hyper, INT_MAX)			\
+  T(hyper, INT_MIN)			\
+  T(hyper, LONG_MAX)			\
+  T(hyper, LONG_MIN)			\
+  T(hyper, LONG_LONG_MAX)		\
+  T(hyper, LONG_LONG_MIN)		\
+  T(hyper, 0x12312345678LL)		\
+  T(hyper, 0x12387654321LL)		\
+  T(u_hyper, 0)				\
+  T(u_hyper, UCHAR_MAX)			\
+  T(u_hyper, USHRT_MAX)			\
+  T(u_hyper, UINT_MAX)			\
+  T(u_hyper, ULONG_MAX)			\
+  T(u_hyper, ULONG_LONG_MAX)		\
+  T(u_hyper, 0xdeadbeefdeadbeefULL)	\
+  T(u_hyper, 0x12312345678ULL)		\
+  T(u_hyper, 0x12387654321ULL)		\
+  T(longlong_t, 0)			\
+  T(longlong_t, CHAR_MAX)		\
+  T(longlong_t, CHAR_MIN)		\
+  T(longlong_t, SHRT_MAX)		\
+  T(longlong_t, SHRT_MIN)		\
+  T(longlong_t, INT_MAX)		\
+  T(longlong_t, INT_MIN)		\
+  T(longlong_t, LONG_MAX)		\
+  T(longlong_t, LONG_MIN)		\
+  T(longlong_t, LONG_LONG_MAX)		\
+  T(longlong_t, LONG_LONG_MIN)		\
+  T(longlong_t, 0x12312345678LL)	\
+  T(longlong_t, 0x12387654321LL)	\
+  T(u_longlong_t, 0)			\
+  T(u_longlong_t, UCHAR_MAX)		\
+  T(u_longlong_t, USHRT_MAX)		\
+  T(u_longlong_t, UINT_MAX)		\
+  T(u_longlong_t, ULONG_MAX)		\
+  T(u_longlong_t, ULONG_LONG_MAX)	\
+  T(u_longlong_t, 0xdeadbeefdeadbeefULL)\
+  T(u_longlong_t, 0x12312345678ULL)	\
+  T(u_longlong_t, 0x12387654321ULL)	\
+  T(short, CHAR_MAX)			\
+  T(short, CHAR_MIN)			\
+  T(short, SHRT_MAX)			\
+  T(short, SHRT_MIN)			\
+  T(short, 0x123)			\
+  T(u_short, 0)				\
+  T(u_short, UCHAR_MAX)			\
+  T(u_short, USHRT_MAX)			\
+  T(u_short, 0xbeef)			\
+  T(u_short, 0x5678)			\
+  T(char, CHAR_MAX)			\
+  T(char, CHAR_MIN)			\
+  T(char, 0x23)				\
+  T(u_char, 0)				\
+  T(u_char, UCHAR_MAX)			\
+  T(u_char, 0xef)			\
+  T(u_char, 0x78)			\
+  T(bool, 0)				\
+  T(bool, 1)				\
+  T(enum, 0)				\
+  T(enum, CHAR_MAX)			\
+  T(enum, CHAR_MIN)			\
+  T(enum, SHRT_MAX)			\
+  T(enum, SHRT_MIN)			\
+  T(enum, INT_MAX)			\
+  T(enum, INT_MIN)			\
+  T(enum, 0x123)			\
+  S(wrapstring, (char *) "")		\
+  S(wrapstring, (char *) "hello, world")
+
+#define T(type, val) \
+  v_##type = val;			\
+  if (! xdr_##type (&xdrs, &v_##type))	\
+    {					\
+      puts ("encoding of " #type	\
+	    " " #val " failed");	\
+      return 1;				\
+    }
+#define S(type, val) T(type, val)
+
+  TESTS
+#undef T
+#undef S
+
+  xdr_destroy (&xdrs);
+
+  xdrmem_create (&xdrs, (char *) buf, sizeof (buf), XDR_DECODE);
+
+#define T(type, val) \
+  v_##type = 0x15;			\
+  if (! xdr_##type (&xdrs, &v_##type))	\
+    {					\
+      puts ("decoding of " #type	\
+	    " " #val " failed");	\
+      return 1;				\
+    }					\
+  if (v_##type != val)			\
+    {					\
+      puts ("decoded value differs, "	\
+	    "type " #type " " #val);	\
+      return 1;				\
+    }
+#define S(type, val) \
+  v_##type = NULL;			\
+  if (! xdr_##type (&xdrs, &v_##type))	\
+    {					\
+      puts ("decoding of " #type	\
+	    " " #val " failed");	\
+      return 1;				\
+    }					\
+  if (strcmp (v_##type, val))		\
+    {					\
+      puts ("decoded value differs, "	\
+	    "type " #type " " #val);	\
+      return 1;				\
+    }					\
+  free (v_##type);			\
+  v_##type = NULL;
+
+  TESTS
+#undef T
+#undef S
+
+  xdr_destroy (&xdrs);
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index d99a9985c4..4213907d96 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -240,7 +240,7 @@ xdr_hyper (XDR *xdrs, quad_t *llp)
       if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
 	return FALSE;
       *llp = ((quad_t) t1) << 32;
-      *llp |= t2;
+      *llp |= (uint32_t) t2;
       return TRUE;
     }
 
@@ -274,7 +274,7 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
       if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
 	return FALSE;
       *ullp = ((u_quad_t) t1) << 32;
-      *ullp |= t2;
+      *ullp |= (uint32_t) t2;
       return TRUE;
     }
 
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index 4daa062c82..e73c5a5202 100644
--- a/sunrpc/xdr_stdio.c
+++ b/sunrpc/xdr_stdio.c
@@ -108,20 +108,20 @@ xdrstdio_destroy (XDR *xdrs)
 static bool_t
 xdrstdio_getlong (XDR *xdrs, long *lp)
 {
-  int32_t mycopy;
+  u_int32_t mycopy;
 
-  if (fread ((caddr_t) & mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
+  if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
     return FALSE;
-  *lp = (int32_t) ntohl (mycopy);
+  *lp = (long) ntohl (mycopy);
   return TRUE;
 }
 
 static bool_t
 xdrstdio_putlong (XDR *xdrs, const long *lp)
 {
-  long mycopy = htonl (*lp);
-  lp = &mycopy;
-  if (fwrite ((caddr_t) lp, 4, 1, (FILE *) xdrs->x_private) != 1)
+  int32_t mycopy = htonl ((u_int32_t) *lp);
+
+  if (fwrite ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
     return FALSE;
   return TRUE;
 }
diff --git a/sysdeps/generic/strnlen.c b/sysdeps/generic/strnlen.c
index c83520e349..6e526bbeba 100644
--- a/sysdeps/generic/strnlen.c
+++ b/sysdeps/generic/strnlen.c
@@ -158,3 +158,4 @@ __strnlen (const char *str, size_t maxlen)
   return char_ptr - str;
 }
 weak_alias (__strnlen, strnlen)
+libc_hidden_def (strnlen)
diff --git a/sysdeps/ia64/strlen.S b/sysdeps/ia64/strlen.S
index a05b054ed8..e765f2f433 100644
--- a/sysdeps/ia64/strlen.S
+++ b/sysdeps/ia64/strlen.S
@@ -73,7 +73,7 @@ ENTRY(strlen)
 	ld8	val1 = [str], 8;;
 	nop.b	0
 	nop.b 	0
-l2:	ld8.s	val2 = [str], 8		// don't bomb out here
+.l2:	ld8.s	val2 = [str], 8		// don't bomb out here
 	czx1.r	pos0 = val1	
 	;;
 	cmp.ne	p6, p0 = 8, pos0
@@ -81,7 +81,7 @@ l2:	ld8.s	val2 = [str], 8		// don't bomb out here
 	chk.s	val2, .recovery
 .back:
 	mov	val1 = val2	
-	br.cond.dptk l2
+	br.cond.dptk	.l2
 .foundit:
 	sub	tmp = str, origadd	// tmp = crt address - orig
 	add	len = len, pos0;;
diff --git a/sysdeps/posix/posix_fallocate.c b/sysdeps/posix/posix_fallocate.c
index 838e7a004a..cbaeb49487 100644
--- a/sysdeps/posix/posix_fallocate.c
+++ b/sysdeps/posix/posix_fallocate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2005 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
@@ -29,9 +29,8 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 {
   struct stat64 st;
   struct statfs f;
-  size_t step;
 
-  /* `off_tī is a signed type.  Therefore we can determine whether
+  /* `off_t' is a signed type.  Therefore we can determine whether
      OFFSET + LEN is too large if it is a negative value.  */
   if (offset < 0 || len < 0)
     return EINVAL;
@@ -47,24 +46,48 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
   if (! S_ISREG (st.st_mode))
     return ENODEV;
 
+  if (len == 0)
+    {
+      if (st.st_size < offset)
+	{
+	  int ret = __ftruncate (fd, offset);
+
+	  if (ret != 0)
+	    ret = errno;
+	  return ret;
+	}
+      return 0;
+    }
+
   /* We have to know the block size of the filesystem to get at least some
      sort of performance.  */
   if (__fstatfs (fd, &f) != 0)
     return errno;
 
-  /* Align OFFSET to block size and adjust LEN.  */
-  step = (offset + f.f_bsize - 1) % ~f.f_bsize;
-  offset += step;
+  /* Try to play safe.  */
+  if (f.f_bsize == 0)
+    f.f_bsize = 512;
 
   /* Write something to every block.  */
-  while (len > step)
+  for (offset += (len - 1) % f.f_bsize; len > 0; offset += f.f_bsize)
     {
-      len -= step;
+      len -= f.f_bsize;
+
+      if (offset < st.st_size)
+	{
+	  unsigned char c;
+	  ssize_t rsize = __pread (fd, &c, 1, offset);
+
+	  if (rsize < 0)
+	    return errno;
+	  /* If there is a non-zero byte, the block must have been
+	     allocated already.  */
+	  else if (rsize == 1 && c != 0)
+	    continue;
+	}
 
       if (__pwrite (fd, "", 1, offset) != 1)
 	return errno;
-
-      offset += step;
     }
 
   return 0;
diff --git a/sysdeps/posix/posix_fallocate64.c b/sysdeps/posix/posix_fallocate64.c
index 0eba4161a5..64ca9ae83d 100644
--- a/sysdeps/posix/posix_fallocate64.c
+++ b/sysdeps/posix/posix_fallocate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2004, 2005 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
@@ -29,9 +29,8 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
 {
   struct stat64 st;
   struct statfs64 f;
-  size_t step;
 
-  /* `off64_tī is a signed type.  Therefore we can determine whether
+  /* `off64_t' is a signed type.  Therefore we can determine whether
      OFFSET + LEN is too large if it is a negative value.  */
   if (offset < 0 || len < 0)
     return EINVAL;
@@ -47,24 +46,48 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
   if (! S_ISREG (st.st_mode))
     return ENODEV;
 
+  if (len == 0)
+    {
+      if (st.st_size < offset)
+	{
+	  int ret = __ftruncate64 (fd, offset);
+
+	  if (ret != 0)
+	    ret = errno;
+	  return ret;
+	}
+      return 0;
+    }
+
   /* We have to know the block size of the filesystem to get at least some
      sort of performance.  */
   if (__fstatfs64 (fd, &f) != 0)
     return errno;
 
-  /* Align OFFSET to block size and adjust LEN.  */
-  step = (offset + f.f_bsize - 1) % ~f.f_bsize;
-  offset += step;
+  /* Try to play safe.  */
+  if (f.f_bsize == 0)
+    f.f_bsize = 512;
 
   /* Write something to every block.  */
-  while (len > step)
+  for (offset += (len - 1) % f.f_bsize; len > 0; offset += f.f_bsize)
     {
-      len -= step;
-
-      if (__pwrite64 (fd, "", 1, offset) != 1)
+      len -= f.f_bsize;
+
+      if (offset < st.st_size)
+	{
+	  unsigned char c;
+	  ssize_t rsize = __libc_pread64 (fd, &c, 1, offset);
+
+	  if (rsize < 0)
+	    return errno;
+	  /* If there is a non-zero byte, the block must have been
+	     allocated already.  */
+	  else if (rsize == 1 && c != 0)
+	    continue;
+	}
+
+      if (__libc_pwrite64 (fd, "", 1, offset) != 1)
 	return errno;
-
-      offset += step;
     }
 
   return 0;
diff --git a/sysdeps/posix/sigignore.c b/sysdeps/posix/sigignore.c
index 361a19e0dc..4fff563197 100644
--- a/sysdeps/posix/sigignore.c
+++ b/sysdeps/posix/sigignore.c
@@ -22,6 +22,8 @@
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
 
 int
 sigignore (sig)
diff --git a/sysdeps/posix/signal.c b/sysdeps/posix/signal.c
index 9a8efee043..076d120e35 100644
--- a/sysdeps/posix/signal.c
+++ b/sysdeps/posix/signal.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 
 
 sigset_t _sigintr attribute_hidden;		/* Set by siginterrupt.  */
diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c
index 873c1cb1e6..e995c73898 100644
--- a/sysdeps/posix/sigset.c
+++ b/sysdeps/posix/sigset.c
@@ -20,6 +20,7 @@
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 
 
 /* Set the disposition for SIG.  */
diff --git a/sysdeps/posix/sysv_signal.c b/sysdeps/posix/sysv_signal.c
index ca2e84f372..9908051206 100644
--- a/sysdeps/posix/sysv_signal.c
+++ b/sysdeps/posix/sysv_signal.c
@@ -18,6 +18,8 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
 
 /* Tolerate non-threads versions of Posix */
 #ifndef SA_ONESHOT
diff --git a/sysdeps/s390/s390-64/bcopy.S b/sysdeps/s390/s390-64/bcopy.S
index ff7966723b..f0df54c340 100644
--- a/sysdeps/s390/s390-64/bcopy.S
+++ b/sysdeps/s390/s390-64/bcopy.S
@@ -59,14 +59,10 @@ ENTRY(__bcopy)
 	jo	.L6
 	br	%r14
 .L7:				    # destructive overlay, can not use mvcle
-	lgr    %r1,%r2		    # bcopy is called with source,dest
-	lgr    %r2,%r3		    # memmove with dest,source! Oh, well...
-	lgr    %r3,%r1
-#ifdef PIC
-	jg     memmove@PLT
-#else
-	jg     memmove
-#endif
+	lgr	%r1,%r2		    # bcopy is called with source,dest
+	lgr	%r2,%r3		    # memmove with dest,source! Oh, well...
+	lgr	%r3,%r1
+	jg	HIDDEN_BUILTIN_JUMPTARGET(memmove)
 
 END(__bcopy)
 
diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c
index 6ef9679045..0a5b83b69c 100644
--- a/sysdeps/unix/sysv/linux/dl-execstack.c
+++ b/sysdeps/unix/sysv/linux/dl-execstack.c
@@ -24,6 +24,7 @@
 #include <stdbool.h>
 #include <stackinfo.h>
 #include <caller.h>
+#include <sysdep.h>
 
 #include "kernel-features.h"
 
@@ -38,6 +39,7 @@ _dl_make_stack_executable (void **stack_endp)
   /* This gives us the highest/lowest page that needs to be changed.  */
   uintptr_t page = ((uintptr_t) *stack_endp
 		    & -(intptr_t) GLRO(dl_pagesize));
+  int result = 0;
 
   /* Challenge the caller.  */
   if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
@@ -60,7 +62,10 @@ _dl_make_stack_executable (void **stack_endp)
 	no_growsupdown = true;
       else
 # endif
-	return errno;
+	{
+	  result = errno;
+	  goto out;
+	}
     }
 #endif
 
@@ -85,7 +90,10 @@ _dl_make_stack_executable (void **stack_endp)
       else
 	{
 	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    return errno;
+	    {
+	      result = errno;
+	      goto out;
+	    }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the top hole page and failed.
@@ -108,7 +116,10 @@ _dl_make_stack_executable (void **stack_endp)
       else
 	{
 	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    return errno;
+	    {
+	      result = errno;
+	      goto out;
+	    }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the lowest hole page and failed.
@@ -133,6 +144,11 @@ _dl_make_stack_executable (void **stack_endp)
   /* Remember that we changed the permission.  */
   GL(dl_stack_flags) |= PF_X;
 
-  return 0;
+ out:
+#ifdef check_consistency
+  check_consistency ();
+#endif
+
+  return result;
 }
 rtld_hidden_def (_dl_make_stack_executable)
diff --git a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
index ee19161272..883508a562 100644
--- a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
+++ b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
@@ -21,7 +21,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-
+#include <not-cancel.h>
 
 static int itc_usable;
 
@@ -31,18 +31,18 @@ has_cpuclock (void)
   if (__builtin_expect (itc_usable == 0, 0))
     {
       int newval = 1;
-      int fd = open ("/proc/sal/itc_drift", O_RDONLY);
+      int fd = open_not_cancel_2 ("/proc/sal/itc_drift", O_RDONLY);
       if (__builtin_expect (fd != -1, 1))
 	{
 	  char buf[16];
 	  /* We expect the file to contain a single digit followed by
 	     a newline.  If the format changes we better not rely on
 	     the file content.  */
-	  if (read (fd, buf, sizeof buf) != 2 || buf[0] != '0'
-	      || buf[1] != '\n')
+	  if (read_not_cancel (fd, buf, sizeof buf) != 2
+	      || buf[0] != '0' || buf[1] != '\n')
 	    newval = -1;
 
-	  close (fd);
+	  close_not_cancel_no_status (fd);
 	}
 
       itc_usable = newval;
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 377ccf5199..f434bbe7d1 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -188,12 +188,8 @@ if_nameindex_netlink (void)
 
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    goto exit_close;
-
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces.  Collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     goto exit_free;
 
   /* Count the interfaces.  */
@@ -290,7 +286,6 @@ if_nameindex_netlink (void)
 
  exit_free:
   __netlink_free_handle (&nh);
- exit_close:
   __netlink_close (&nh);
 
   return idx;
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 8a052e212d..6f43475ca9 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <alloca.h>
 #include <assert.h>
 #include <errno.h>
 #include <ifaddrs.h>
@@ -24,6 +25,7 @@
 #include <netinet/in.h>
 #include <netpacket/packet.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -84,7 +86,7 @@ __netlink_free_handle (struct netlink_handle *h)
 }
 
 
-int
+static int
 __netlink_sendreq (struct netlink_handle *h, int type)
 {
   struct
@@ -114,15 +116,39 @@ __netlink_sendreq (struct netlink_handle *h, int type)
 
 
 int
-__netlink_receive (struct netlink_handle *h)
+__netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
+  struct netlink_res **new_nlm_list;
+  static volatile size_t buf_size = 4096;
+  char *buf;
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
-  int read_len;
+  ssize_t read_len;
   bool done = false;
+  bool use_malloc = false;
+
+  if (__netlink_sendreq (h, type) < 0)
+    return -1;
+
+  size_t this_buf_size = buf_size;
+  if (__libc_use_alloca (this_buf_size))
+    buf = alloca (this_buf_size);
+  else
+    {
+      buf = malloc (this_buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, this_buf_size };
+
+  if (h->nlm_list != NULL)
+    new_nlm_list = &h->end_ptr->next;
+  else
+    new_nlm_list = &h->nlm_list;
 
   while (! done)
     {
@@ -136,33 +162,66 @@ __netlink_receive (struct netlink_handle *h)
 
       read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
-      if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+      if (nladdr.nl_pid != 0)
+	continue;
 
-      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
-						+ read_len);
-      if (nlm_next == NULL)
-	return -1;
-      nlm_next->next = NULL;
-      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
-      nlm_next->size = read_len;
-      nlm_next->seq = h->seq;
-      if (h->nlm_list == NULL)
-	h->nlm_list = nlm_next;
-      else
-	h->end_ptr->next = nlm_next;
-      h->end_ptr = nlm_next;
+      if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
+	{
+	  if (this_buf_size >= SIZE_MAX / 2)
+	    goto out_fail;
+
+	  nlm_next = *new_nlm_list;
+	  while (nlm_next != NULL)
+	    {
+	      struct netlink_res *tmpptr;
+
+	      tmpptr = nlm_next->next;
+	      free (nlm_next);
+	      nlm_next = tmpptr;
+	    }
+	  *new_nlm_list = NULL;
+
+	  if (__libc_use_alloca (2 * this_buf_size))
+	    buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size);
+	  else
+	    {
+	      this_buf_size *= 2;
+
+	      char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size);
+	      if (new_buf == NULL)
+		goto out_fail;
+	      new_buf = buf;
 
+	      use_malloc = true;
+	    }
+	  buf_size = this_buf_size;
+
+	  iov.iov_base = buf;
+	  iov.iov_len = this_buf_size;
+
+	  /* Increase sequence number, so that we can distinguish
+	     between old and new request messages.  */
+	  h->seq++;
+
+	  if (__netlink_sendreq (h, type) < 0)
+	    goto out_fail;
+
+	  continue;
+	}
+
+      size_t count = 0;
+      size_t remaining_len = read_len;
       for (nlmh = (struct nlmsghdr *) buf;
-	   NLMSG_OK (nlmh, (size_t) read_len);
-	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
+	   NLMSG_OK (nlmh, remaining_len);
+	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len))
 	{
-	  if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != h->pid
+	  if ((pid_t) nlmh->nlmsg_pid != h->pid
 	      || nlmh->nlmsg_seq != h->seq)
 	    continue;
 
+	  ++count;
 	  if (nlmh->nlmsg_type == NLMSG_DONE)
 	    {
 	      /* We found the end, leave the loop.  */
@@ -176,11 +235,38 @@ __netlink_receive (struct netlink_handle *h)
 		errno = EIO;
 	      else
 		errno = -nlerr->error;
-	      return -1;
+	      goto out_fail;
 	    }
 	}
+
+      /* If there was nothing with the expected nlmsg_pid and nlmsg_seq,
+	 there is no point to record it.  */
+      if (count == 0)
+	continue;
+
+      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
+						+ read_len);
+      if (nlm_next == NULL)
+	goto out_fail;
+      nlm_next->next = NULL;
+      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
+      nlm_next->size = read_len;
+      nlm_next->seq = h->seq;
+      if (h->nlm_list == NULL)
+	h->nlm_list = nlm_next;
+      else
+	h->end_ptr->next = nlm_next;
+      h->end_ptr = nlm_next;
     }
+
+  if (use_malloc)
+    free (buf);
   return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
+  return -1;
 }
 
 
@@ -268,7 +354,7 @@ getifaddrs (struct ifaddrs **ifap)
   unsigned int i, newlink, newaddr, newaddr_idx;
   int *map_newlink_data;
   size_t ifa_data_size = 0;  /* Size to allocate for all ifa_data.  */
-  char *ifa_data_ptr;        /* Pointer to the unused part of memory for
+  char *ifa_data_ptr;	/* Pointer to the unused part of memory for
 				ifa_data.  */
   int result = 0;
 
@@ -288,28 +374,20 @@ getifaddrs (struct ifaddrs **ifap)
 #endif
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    {
-      result = -1;
-      goto exit_close;
-    }
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces, collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     {
       result = -1;
       goto exit_free;
     }
 
-
   /* Now ask the kernel for all addresses which are assigned
-     to an interface.  Since we store the addresses after the
-     interfaces in the list, we will later always find the
-     interface before the corresponding addresses.  */
+     to an interface and collect all data for every interface.
+     Since we store the addresses after the interfaces in the
+     list, we will later always find the interface before the
+     corresponding addresses.  */
   ++nh.seq;
-  if (__netlink_sendreq (&nh, RTM_GETADDR) < 0
-      /* Collect all data for every interface.  */
-      || __netlink_receive (&nh) < 0)
+  if (__netlink_request (&nh, RTM_GETADDR) < 0)
     {
       result = -1;
       goto exit_free;
@@ -327,7 +405,7 @@ getifaddrs (struct ifaddrs **ifap)
 	continue;
 
       /* Walk through all entries we got from the kernel and look, which
-         message type they contain.  */
+	 message type they contain.  */
       for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size))
 	{
 	  /* Check if the message is what we want.  */
@@ -423,7 +501,7 @@ getifaddrs (struct ifaddrs **ifap)
 	      /* Interfaces are stored in the first "newlink" entries
 		 of our list, starting in the order as we got from the
 		 kernel.  */
-              ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
+	      ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
 				       map_newlink_data, newlink);
 	      ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags;
 
@@ -767,8 +845,6 @@ getifaddrs (struct ifaddrs **ifap)
 
  exit_free:
   __netlink_free_handle (&nh);
-
- exit_close:
   __netlink_close (&nh);
 
   return result;
diff --git a/sysdeps/unix/sysv/linux/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h
index 6672e714ff..f0b8e364bc 100644
--- a/sysdeps/unix/sysv/linux/netlinkaccess.h
+++ b/sysdeps/unix/sysv/linux/netlinkaccess.h
@@ -55,8 +55,7 @@ extern int __no_netlink_support attribute_hidden;
 extern int __netlink_open (struct netlink_handle *h);
 extern void __netlink_close (struct netlink_handle *h);
 extern void __netlink_free_handle (struct netlink_handle *h);
-extern int __netlink_sendreq (struct netlink_handle *h, int type);
-extern int __netlink_receive (struct netlink_handle *h);
+extern int __netlink_request (struct netlink_handle *h, int type);
 
 
 #endif /* netlinkaccess.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
index e79d74cb75..069f94bd9d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2005 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
@@ -28,7 +28,7 @@
 #ifdef __NR_ftruncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-extern int have_no_truncate64;
+extern int __have_no_truncate64;
 #endif
 
 
@@ -39,7 +39,7 @@ __ftruncate64 (fd, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -57,7 +57,7 @@ __ftruncate64 (fd, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
index ce8ebc2a97..01698a419f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
@@ -29,7 +29,7 @@
 #ifdef __NR_truncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-int have_no_truncate64;
+int __have_no_truncate64;
 #endif
 
 
@@ -40,7 +40,7 @@ truncate64 (path, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -58,7 +58,7 @@ truncate64 (path, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c
index d94e4f62fd..4f2b8acc55 100644
--- a/sysdeps/unix/sysv/linux/sleep.c
+++ b/sysdeps/unix/sysv/linux/sleep.c
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <time.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <unistd.h>
 #include <sys/param.h>
 
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index a8baf40a91..be2810e0c7 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -41,6 +41,14 @@
 #include <sys/types.h>
 
 /*
+ * Select between different incompatible quota versions.
+ * Default to the version used by Linux kernel version 2.4.22
+ * or later.  */
+#ifndef _LINUX_QUOTA_VERSION
+# define _LINUX_QUOTA_VERSION 2
+#endif
+
+/*
  * Convert diskblocks to blocks and the other way around.
  * currently only to fool the BSD source. :-)
  */
@@ -94,21 +102,33 @@
 #define SUBCMDSHIFT 8
 #define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
 
-#define Q_QUOTAON  0x0100	/* enable quotas */
-#define Q_QUOTAOFF 0x0200	/* disable quotas */
-#define Q_GETQUOTA 0x0300	/* get limits and usage */
-#define Q_SETQUOTA 0x0400	/* set limits and usage */
-#define Q_SETUSE   0x0500	/* set usage */
-#define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
-#define Q_SETQLIM  0x0700	/* set limits */
-#define Q_GETSTATS 0x0800	/* get collected stats */
-#define Q_RSQUASH  0x1000	/* set root_squash option */
+#if _LINUX_QUOTA_VERSION < 2
+# define Q_QUOTAON  0x0100	/* enable quotas */
+# define Q_QUOTAOFF 0x0200	/* disable quotas */
+# define Q_GETQUOTA 0x0300	/* get limits and usage */
+# define Q_SETQUOTA 0x0400	/* set limits and usage */
+# define Q_SETUSE   0x0500	/* set usage */
+# define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
+# define Q_SETQLIM  0x0700	/* set limits */
+# define Q_GETSTATS 0x0800	/* get collected stats */
+# define Q_RSQUASH  0x1000	/* set root_squash option */
+#else
+# define Q_SYNC     0x800001	/* sync disk copy of a filesystems quotas */
+# define Q_QUOTAON  0x800002	/* turn quotas on */
+# define Q_QUOTAOFF 0x800003	/* turn quotas off */
+# define Q_GETFMT   0x800004	/* get quota format used on given filesystem */
+# define Q_GETINFO  0x800005	/* get information about quota files */
+# define Q_SETINFO  0x800006	/* set information about quota files */
+# define Q_GETQUOTA 0x800007	/* get user quota structure */
+# define Q_SETQUOTA 0x800008	/* set user quota structure */
+#endif
 
 /*
  * The following structure defines the format of the disk quota file
  * (as it appears on disk) - the file is an array of these structures
  * indexed by user or group number.
  */
+#if _LINUX_QUOTA_VERSION < 2
 struct dqblk
   {
     u_int32_t dqb_bhardlimit;	/* absolute limit on disk blks alloc */
@@ -120,13 +140,45 @@ struct dqblk
     time_t dqb_btime;		/* time limit for excessive disk use */
     time_t dqb_itime;		/* time limit for excessive files */
   };
+#else
+
+/* Flags that indicate which fields in dqblk structure are valid.  */
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk
+  {
+    u_int64_t dqb_bhardlimit;	/* absolute limit on disk quota blocks alloc */
+    u_int64_t dqb_bsoftlimit;	/* preferred limit on disk quota blocks */
+    u_int64_t dqb_curspace;	/* current quota block count */
+    u_int64_t dqb_ihardlimit;	/* maximum # allocated inodes */
+    u_int64_t dqb_isoftlimit;	/* preferred inode limit */
+    u_int64_t dqb_curinodes;	/* current # allocated inodes */
+    u_int64_t dqb_btime;	/* time limit for excessive disk use */
+    u_int64_t dqb_itime;	/* time limit for excessive files */
+    u_int32_t dqb_valid;	/* bitmask of QIF_* constants */
+  };
+#endif
 
 /*
  * Shorthand notation.
  */
 #define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
 #define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
-#define	dq_curblocks	dq_dqb.dqb_curblocks
+#if _LINUX_QUOTA_VERSION < 2
+# define dq_curblocks	dq_dqb.dqb_curblocks
+#else
+# define dq_curspace	dq_dqb.dqb_curspace
+# define dq_valid	dq_dqb.dqb_valid
+#endif
 #define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
 #define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
 #define	dq_curinodes	dq_dqb.dqb_curinodes
@@ -135,6 +187,7 @@ struct dqblk
 
 #define dqoff(UID)      ((loff_t)((UID) * sizeof (struct dqblk)))
 
+#if _LINUX_QUOTA_VERSION < 2
 struct dqstats
   {
     u_int32_t lookups;
@@ -147,6 +200,22 @@ struct dqstats
     u_int32_t free_dquots;
     u_int32_t syncs;
   };
+#else
+
+/* Flags that indicate which fields in dqinfo structure are valid.  */
+# define IIF_BGRACE	1
+# define IIF_IGRACE	2
+# define IIF_FLAGS	4
+# define IIF_ALL	(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo
+  {
+    u_int64_t dqi_bgrace;
+    u_int64_t dqi_igrace;
+    u_int32_t dqi_flags;
+    u_int32_t dqi_valid;
+  };
+#endif
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
index 7e601acf2c..1cdeb12638 100644
--- a/sysdeps/unix/sysv/linux/sysctl.c
+++ b/sysdeps/unix/sysv/linux/sysctl.c
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sys/sysctl.h>
 
 #include <sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/system.c b/sysdeps/unix/sysv/linux/system.c
index 3fdff04c22..688487cb9f 100644
--- a/sysdeps/unix/sysv/linux/system.c
+++ b/sysdeps/unix/sysv/linux/system.c
@@ -18,6 +18,7 @@
 
 #include <sched.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sysdep.h>
 #include <unistd.h>
 #include <sys/wait.h>
diff --git a/time/Makefile b/time/Makefile
index 7acc964fdc..799a8b70fa 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -35,7 +35,7 @@ distribute := datemsk
 
 tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
 	   tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
-	   tst-mktime3
+	   tst-mktime3 tst-strptime2
 
 include ../Rules
 
diff --git a/time/mktime.c b/time/mktime.c
index c6ae56ee60..f011412327 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -38,10 +38,11 @@
 
 #include <limits.h>
 
+#include <string.h>		/* For the real memcpy prototype.  */
+
 #if DEBUG
 # include <stdio.h>
 # include <stdlib.h>
-# include <string.h>
 /* Make it work even if the system's libc has its own mktime routine.  */
 # define mktime my_mktime
 #endif /* DEBUG */
diff --git a/time/strptime_l.c b/time/strptime_l.c
index cf0ab7153d..ccb838a229 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -687,6 +687,42 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 	case 'Z':
 	  /* XXX How to handle this?  */
 	  break;
+	case 'z':
+	  /* We recognize two formats: if two digits are given, these
+	     specify hours.  If fours digits are used, minutes are
+	     also specified.  */
+	  {
+	    val = 0;
+	    while (*rp == ' ')
+	      ++rp;
+	    if (*rp != '+' && *rp != '-')
+	      return NULL;
+	    bool neg = *rp++ == '-';
+	    int n = 0;
+	    while (n < 4 && *rp >= '0' && *rp <= '9')
+	      {
+		val = val * 10 + *rp++ - '0';
+		++n;
+	      }
+	    if (n == 2)
+	      val *= 100;
+	    else if (n != 4)
+	      /* Only two or four digits recognized.  */
+	      return NULL;
+	    else
+	      {
+		/* We have to convert the minutes into decimal.  */
+		if (val % 100 >= 60)
+		  return NULL;
+		val = (val / 100) * 100 + ((val % 100) * 50) / 30;
+	      }
+	    if (val > 1200)
+	      return NULL;
+	    tm->tm_gmtoff = (val * 3600) / 100;
+	    if (neg)
+	      tm->tm_gmtoff = -tm->tm_gmtoff;
+	  }
+	  break;
 	case 'E':
 #ifdef _NL_CURRENT
 	  switch (*fmt++)
diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c
new file mode 100644
index 0000000000..73552bb8f8
--- /dev/null
+++ b/time/tst-strptime2.c
@@ -0,0 +1,59 @@
+#include <limits.h>
+#include <stdio.h>
+#include <time.h>
+
+
+static const struct
+{
+  const char *fmt;
+  long int gmtoff;
+} tests[] =
+  {
+    { "1113472456 +1000", 36000 },
+    { "1113472456 -1000", -36000 },
+    { "1113472456 +10", 36000 },
+    { "1113472456 -10", -36000 },
+    { "1113472456 +1030", 37800 },
+    { "1113472456 -1030", -37800 },
+    { "1113472456 +0030", 1800 },
+    { "1113472456 -0030", -1800 },
+    { "1113472456 -1330", LONG_MAX },
+    { "1113472456 +1330", LONG_MAX },
+    { "1113472456 -1060", LONG_MAX },
+    { "1113472456 +1060", LONG_MAX },
+    { "1113472456  1030", LONG_MAX },
+  };
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+
+
+int
+main (void)
+{
+  int result = 0;
+
+  for (int i = 0; i < ntests; ++i)
+    {
+      struct tm tm;
+
+      if (strptime (tests[i].fmt, "%s %z", &tm) == NULL)
+	{
+	  if (tests[i].gmtoff != LONG_MAX)
+	    {
+	      printf ("round %d: strptime unexpectedly failed\n", i);
+	      result = 1;
+	    }
+	  continue;
+	}
+
+      if (tm.tm_gmtoff != tests[i].gmtoff)
+	{
+	  printf ("round %d: tm_gmtoff is %ld\n", i, (long int) tm.tm_gmtoff);
+	  result = 1;
+	}
+    }
+
+  if (result == 0)
+    puts ("all OK");
+
+  return 0;
+}