about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-04-24 08:55:46 +0000
committerJakub Jelinek <jakub@redhat.com>2006-04-24 08:55:46 +0000
commitd0145e03799e484f3a53d79de3b3f34162ee9d3c (patch)
treed8c51a0952204f9015de0db3319d4c820e8646e0
parentf5ce81c94cc27035f44d37bffa7f7e08dbce7631 (diff)
downloadglibc-d0145e03799e484f3a53d79de3b3f34162ee9d3c.tar.gz
glibc-d0145e03799e484f3a53d79de3b3f34162ee9d3c.tar.xz
glibc-d0145e03799e484f3a53d79de3b3f34162ee9d3c.zip
Updated to fedora-glibc-20060424T0820
-rw-r--r--ChangeLog520
-rw-r--r--NEWS10
-rw-r--r--Versions.def1
-rw-r--r--argp/argp.h5
-rw-r--r--bits/siginfo.h2
-rw-r--r--elf/cache.c13
-rw-r--r--elf/ldconfig.c2
-rw-r--r--elf/ldd.bash.in5
-rw-r--r--elf/rtld.c2
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in4
-rw-r--r--iconv/iconv_charmap.c4
-rw-r--r--iconvdata/Makefile8
-rw-r--r--iconvdata/ibm437.c4
-rw-r--r--iconvdata/ibm861.c4
-rw-r--r--iconvdata/ibm862.c4
-rw-r--r--iconvdata/ibm863.c4
-rw-r--r--iconvdata/ibm865.c4
-rw-r--r--include/ifaddrs.h14
-rw-r--r--inet/check_pf.c10
-rw-r--r--inet/getnameinfo.c25
-rw-r--r--inet/inet6_option.c6
-rw-r--r--inet/inet_ntoa.c69
-rw-r--r--inet/rexec.c5
-rw-r--r--intl/explodename.c4
-rw-r--r--intl/finddomain.c23
-rw-r--r--io/fts.c21
-rw-r--r--io/readlink.c4
-rw-r--r--io/readlinkat.c4
-rw-r--r--libio/fmemopen.c11
-rw-r--r--locale/programs/ld-address.c10
-rw-r--r--locale/programs/ld-numeric.c23
-rw-r--r--locale/programs/linereader.c8
-rw-r--r--localedata/ChangeLog49
-rw-r--r--localedata/SUPPORTED8
-rw-r--r--localedata/locales/af_ZA15
-rw-r--r--localedata/locales/ca_AD94
-rw-r--r--localedata/locales/ca_FR85
-rw-r--r--localedata/locales/ca_IT85
-rw-r--r--localedata/locales/cs_CZ2
-rw-r--r--localedata/locales/de_CH4
-rw-r--r--localedata/locales/en_US2
-rw-r--r--localedata/locales/en_ZA15
-rw-r--r--localedata/locales/nr_ZA281
-rw-r--r--localedata/locales/pa_PK187
-rw-r--r--localedata/locales/pl_PL1
-rw-r--r--localedata/locales/sk_SK2
-rw-r--r--localedata/locales/st_ZA46
-rw-r--r--localedata/locales/vi_VN34
-rw-r--r--localedata/locales/xh_ZA74
-rw-r--r--localedata/locales/zu_ZA74
-rw-r--r--mach/Machrules5
-rw-r--r--misc/tsearch.c11
-rw-r--r--nis/Makefile4
-rw-r--r--nis/Versions6
-rw-r--r--nis/libnsl.h24
-rw-r--r--nis/nis_call.c4
-rw-r--r--nis/nis_checkpoint.c5
-rw-r--r--nis/nis_clone_dir.c25
-rw-r--r--nis/nis_clone_res.c27
-rw-r--r--nis/nis_creategroup.c14
-rw-r--r--nis/nis_getservlist.c57
-rw-r--r--nis/nis_ismember.c5
-rw-r--r--nis/nis_local_names.c6
-rw-r--r--nis/nis_ping.c11
-rw-r--r--nis/nis_print_group_entry.c14
-rw-r--r--nis/nis_removemember.c8
-rw-r--r--nis/nis_table.c41
-rw-r--r--nis/nss-default.c117
-rw-r--r--nis/nss-nis.c87
-rw-r--r--nis/nss-nis.h14
-rw-r--r--nis/nss_nis/nis-alias.c76
-rw-r--r--nis/nss_nis/nis-ethers.c75
-rw-r--r--nis/nss_nis/nis-grp.c96
-rw-r--r--nis/nss_nis/nis-hosts.c122
-rw-r--r--nis/nss_nis/nis-initgroups.c29
-rw-r--r--nis/nss_nis/nis-netgrp.c12
-rw-r--r--nis/nss_nis/nis-network.c115
-rw-r--r--nis/nss_nis/nis-proto.c60
-rw-r--r--nis/nss_nis/nis-publickey.c106
-rw-r--r--nis/nss_nis/nis-pwd.c119
-rw-r--r--nis/nss_nis/nis-rpc.c55
-rw-r--r--nis/nss_nis/nis-service.c106
-rw-r--r--nis/nss_nis/nis-spwd.c64
-rw-r--r--nis/nss_nisplus/nisplus-alias.c57
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c40
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c88
-rw-r--r--nis/nss_nisplus/nisplus-netgrp.c10
-rw-r--r--nis/nss_nisplus/nisplus-network.c67
-rw-r--r--nis/nss_nisplus/nisplus-parser.c59
-rw-r--r--nis/nss_nisplus/nisplus-proto.c64
-rw-r--r--nis/nss_nisplus/nisplus-publickey.c35
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c70
-rw-r--r--nis/nss_nisplus/nisplus-service.c78
-rw-r--r--nis/ypclnt.c12
-rw-r--r--nptl/ChangeLog35
-rw-r--r--nptl/init.c20
-rw-r--r--nptl/pthreadP.h2
-rw-r--r--nptl/pthread_getattr_np.c76
-rw-r--r--nptl/sysdeps/pthread/pthread.h246
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h16
-rw-r--r--nscd/Makefile9
-rw-r--r--nscd/connections.c28
-rw-r--r--nscd/nscd.c6
-rw-r--r--nscd/nscd_helper.c37
-rw-r--r--nss/nss_files/files-key.c3
-rw-r--r--posix/Makefile2
-rw-r--r--posix/bits/unistd.h16
-rw-r--r--posix/regex.h11
-rw-r--r--posix/tst-rfc3484-2.c128
-rw-r--r--posix/tst-rfc3484.c4
-rw-r--r--posix/unistd.h9
-rw-r--r--signal/Makefile5
-rw-r--r--signal/tst-sigset2.c184
-rw-r--r--soft-fp/adddf3.c13
-rw-r--r--soft-fp/addsf3.c13
-rw-r--r--soft-fp/addtf3.c13
-rw-r--r--soft-fp/divdf3.c13
-rw-r--r--soft-fp/divsf3.c13
-rw-r--r--soft-fp/divtf3.c13
-rw-r--r--soft-fp/double.h13
-rw-r--r--soft-fp/eqdf2.c13
-rw-r--r--soft-fp/eqsf2.c13
-rw-r--r--soft-fp/eqtf2.c13
-rw-r--r--soft-fp/extenddftf2.c13
-rw-r--r--soft-fp/extended.h13
-rw-r--r--soft-fp/extendsfdf2.c13
-rw-r--r--soft-fp/extendsftf2.c13
-rw-r--r--soft-fp/fixdfdi.c13
-rw-r--r--soft-fp/fixdfsi.c13
-rw-r--r--soft-fp/fixsfdi.c13
-rw-r--r--soft-fp/fixsfsi.c13
-rw-r--r--soft-fp/fixtfdi.c13
-rw-r--r--soft-fp/fixtfsi.c13
-rw-r--r--soft-fp/fixunsdfdi.c13
-rw-r--r--soft-fp/fixunsdfsi.c13
-rw-r--r--soft-fp/fixunssfdi.c13
-rw-r--r--soft-fp/fixunssfsi.c13
-rw-r--r--soft-fp/fixunstfdi.c13
-rw-r--r--soft-fp/fixunstfsi.c13
-rw-r--r--soft-fp/floatdidf.c13
-rw-r--r--soft-fp/floatdisf.c13
-rw-r--r--soft-fp/floatditf.c13
-rw-r--r--soft-fp/floatsidf.c13
-rw-r--r--soft-fp/floatsisf.c13
-rw-r--r--soft-fp/floatsitf.c13
-rw-r--r--soft-fp/floatundidf.c13
-rw-r--r--soft-fp/floatundisf.c13
-rw-r--r--soft-fp/floatunditf.c13
-rw-r--r--soft-fp/floatunsidf.c13
-rw-r--r--soft-fp/floatunsisf.c13
-rw-r--r--soft-fp/floatunsitf.c13
-rw-r--r--soft-fp/gedf2.c13
-rw-r--r--soft-fp/gesf2.c13
-rw-r--r--soft-fp/getf2.c13
-rw-r--r--soft-fp/ledf2.c13
-rw-r--r--soft-fp/lesf2.c13
-rw-r--r--soft-fp/letf2.c13
-rw-r--r--soft-fp/muldf3.c13
-rw-r--r--soft-fp/mulsf3.c13
-rw-r--r--soft-fp/multf3.c13
-rw-r--r--soft-fp/negdf2.c13
-rw-r--r--soft-fp/negsf2.c13
-rw-r--r--soft-fp/negtf2.c13
-rw-r--r--soft-fp/op-1.h13
-rw-r--r--soft-fp/op-2.h13
-rw-r--r--soft-fp/op-4.h13
-rw-r--r--soft-fp/op-8.h13
-rw-r--r--soft-fp/op-common.h13
-rw-r--r--soft-fp/quad.h13
-rw-r--r--soft-fp/single.h13
-rw-r--r--soft-fp/soft-fp.h13
-rw-r--r--soft-fp/sqrtdf2.c13
-rw-r--r--soft-fp/sqrtsf2.c13
-rw-r--r--soft-fp/sqrttf2.c13
-rw-r--r--soft-fp/subdf3.c13
-rw-r--r--soft-fp/subsf3.c13
-rw-r--r--soft-fp/subtf3.c13
-rw-r--r--soft-fp/truncdfsf2.c13
-rw-r--r--soft-fp/trunctfdf2.c13
-rw-r--r--soft-fp/trunctfsf2.c13
-rw-r--r--soft-fp/unorddf2.c13
-rw-r--r--soft-fp/unordsf2.c13
-rw-r--r--soft-fp/unordtf2.c13
-rw-r--r--string/Makefile2
-rw-r--r--sunrpc/rpc_cout.c1
-rw-r--r--sunrpc/rpc_main.c38
-rw-r--r--sunrpc/rpc_parse.c7
-rw-r--r--sunrpc/rpc_scan.c1
-rw-r--r--sunrpc/svc_udp.c4
-rw-r--r--sysdeps/generic/unwind-dw2-fde.c4
-rw-r--r--sysdeps/generic/unwind-dw2.c8
-rw-r--r--sysdeps/posix/getaddrinfo.c184
-rw-r--r--sysdeps/posix/sigset.c23
-rw-r--r--sysdeps/posix/tempname.c10
-rw-r--r--sysdeps/powerpc/fpu/bits/mathinline.h6
-rw-r--r--sysdeps/powerpc/fpu/e_sqrt.c4
-rw-r--r--sysdeps/powerpc/fpu/e_sqrtf.c4
-rw-r--r--sysdeps/powerpc/powerpc32/bits/atomic.h15
-rw-r--r--sysdeps/unix/sysv/linux/Versions3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h33
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h12
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c82
-rw-r--r--sysdeps/unix/sysv/linux/getcwd.c2
-rw-r--r--sysdeps/unix/sysv/linux/getsourcefilter.c28
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/fcntl.h33
-rw-r--r--sysdeps/unix/sysv/linux/i386/sync_file_range.S72
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/fcntl.h33
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h33
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/procfs.h2
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c2
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h33
-rw-r--r--sysdeps/unix/sysv/linux/setsourcefilter.c9
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/fcntl.h33
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h33
-rw-r--r--sysdeps/unix/sysv/linux/sync_file_range.c46
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c30
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c31
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h33
232 files changed, 4925 insertions, 1766 deletions
diff --git a/ChangeLog b/ChangeLog
index 1efd878662..62c3fe23fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,519 @@
+2006-04-23  Ulrich Drepper  <drepper@redhat.com>
+
+	* nis/nss_nisplus/nisplus-netgrp.c: Cleanups.	
+
+	[BZ #1951]
+	* sysdeps/posix/sigset.c (sigset): Return correct value reflecting
+	previous signal state.
+	* signal/Makefile (tests): Add tst-sigset2.
+	* signal/tst-sigset2.c: New file.
+
+2006-04-21  Jakub Jelinek  <jakub@redhat.com>
+
+	* argp/argp.h (__option_is_short): Check upper limit of
+	__key.  isprint() requires its argument to have the value
+	of an unsigned char or EOF.
+	Patch by Sergey Poznyakoff <gray@Mirddin.farlep.net>.
+
+2006-04-21  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #2534, BZ #2535]
+	* posix/regex.h: Remove obsolete <sys/types.h> comment and special
+	handling for VMS.
+
+	* iconvdata/ibm437.c: Define HAS_HOLES to 0.
+	* iconvdata/ibm861.c: Likewise.
+	* iconvdata/ibm862.c: Likewise.
+	* iconvdata/ibm863.c: Likewise.
+	* iconvdata/ibm865.c: Likewise.
+	Reported by <ash@contact.bg>.
+
+2006-04-19  Ulrich Drepper  <drepper@redhat.com>
+
+	* include/ifaddrs.h: Get uint32_t definition.
+	* posix/tst-rfc3484.c: Update fake __check_pf implementation.
+	* posix/tst-rfc3484-2.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/kernel-features.h: Define
+	__ASSUME_PROC_SELF_FD_SYMLINK.
+	* sysdeps/unix/sysv/linux/ttyname.c: Cleanups.  Avoid compatibility
+	code if possible.  Move compatibility code in .text.compat section.
+	* sysdeps/unix/sysv/linux/ttyname_r.c: Likewise.
+
+2006-04-18  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Rewrite to avoid loop
+	over gaih array.  There is only on function to call in the moment.
+
+2006-04-16  Ulrich Drepper  <drepper@redhat.com>
+
+	* include/ifaddrs.h: Define struct in6addrinfo.
+	Add two more parameters to __check_pf.
+	* sysdeps/unix/sysv/linux/check_pf.c: When using the netlink
+	interface, determine whether IPv6 addresses are deprecated or
+	temporary.  Create array of those addresses.
+	* inet/check_pf.c: Always tell caller there are no depracated
+	and temporary addresses.
+	* sysdeps/posix/getaddrinfo.c: Pretty printing.
+	(struct sort_result): Add source_addr_flags field.
+	(rfc3484_sort): Implement rule 3 and 7.
+	(in6aicmp): New function.
+	(getaddrinfo): Call __check_pf also when we need info about IPv6
+	source addresses.  When creating array for sorting addresses,
+	look up deprecated and temporary addresses returned by __check_pf
+	and add flag if necessary.
+
+2006-04-15  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c: Fix precedence for IP V4-to-V6
+	mapped addresses.
+	* posix/Makefile (tests): Add tst-rfc3484-2.
+	* posix/tst-rfc3484-2.c: New file.
+
+	* nis/nss_nisplus/nisplus-publickey.c: Minor cleanups throughout.
+	* nis/nss_nisplus/nisplus-service.c (_nss_nisplus_parse_servent):
+	Significant cleanups.  Correct adjustment for pointer array.
+	* nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_parse_rpcent):
+	Likewise.
+	* nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_parse_protoent):
+	Likewise.
+	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_parse_netent):
+	Likewise.
+	* nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent):
+	Likewise.
+
+2006-04-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/syscalls.list: Add tee syscall.
+	* sysdeps/unix/sysv/linux/Versions: Export tee@GLIBC_2.5.
+	* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Add prototype for tee.
+	* sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
+
+	* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_parse_etherent):
+	Minor cleanups.  NUL terminate name string.
+
+	* nis/Versions: No need to export _nss_nisplus_parse_grent,
+	_nss_nisplus_parse_pwent, and _nss_nisplus_parse_spent.
+
+	* nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_parse_aliasent):
+	Avoid unnecessary allocation.  Fix adjustment for pointer value.
+
+	* nis/nss_nisplus/nisplus-parser.c: Cleanups, use NIS_RES_*
+	macros.  Avoid unnecessary allocation.
+
+	* sysdeps/unix/sysv/linux/sync_file_range.c: New file.
+
+2006-04-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* nis/Makefile (libnsl-routimes): Add nss-default.
+	* nis/Versions (libnsl) [GLIBC_PRIVATE]: Export _nsl_default_nss.
+	* nis/nss-nis.c: Move /etc/default/nss handling to...
+	* nis/nss-default.c: ...here.  New file.
+	* nis/libnsl.h: New file.
+	* nis/nss-nis.h: Remove NSS_FLAG_* definitions and _nis_default_nss
+	plus auxilary definitions.
+	* nis/nss_nis/nis-initgroups.c: Use _nsl_default_nss instead of
+	_nis_default_nss.
+	* nis/nss_nis/nis-service.c: Likewise.
+
+2006-04-07  Steven Munroe  <sjmunroe@us.ibm.com>
+
+	* sysdeps/powerpc/fpu/bits/mathinline.h
+	[__WORDSIZE == 64 || _ARCH_PWR4]: Define __CPU_HAS_FSQRT.
+	(__ieee754_sqrt): Fix comment.
+	(__ieee754_sqrtf): Fix comment.
+	* sysdeps/powerpc/fpu/e_sqrt.c (__ieee754_sqrt): Fix comment.
+	Check __CPU_HAS_FSQRT instead of dl_hwcap.
+	* sysdeps/powerpc/fpu/e_sqrtf.c (__ieee754_sqrtf): Likewise.
+
+2006-04-08  Ulrich Drepper  <drepper@redhat.com>
+
+	* inet/inet_ntoa.c: Rewrite to use TLS instead of TSD.
+
+	* nis/nss_nis/nis-alias.c: Optimize use of yperr2nss.  Avoid calling
+	it for YPERR_SUCCESS.  Minor cleanups.  Add __builtin_expect.
+	* nis/nss_nis/nis-ethers.c: Likewise.
+	* nis/nss_nis/nis-grp.c: Likewise.
+	* nis/nss_nis/nis-hosts.c: Likewise.
+	* nis/nss_nis/nis-initgroups.c: Likewise.
+	* nis/nss_nis/nis-netgrp.c: Likewise.
+	* nis/nss_nis/nis-network.c: Likewise.
+	* nis/nss_nis/nis-proto.c: Likewise.
+	* nis/nss_nis/nis-publickey.c: Likewise.
+	* nis/nss_nis/nis-pwd.c: Likewise.
+	* nis/nss_nis/nis-rpc.c: Likewise.
+	* nis/nss_nis/nis-service.c: Likewise.
+	* nis/nss_nis/nis-spwd.c: Likewise.
+
+	* nis/nis_ping.c: Remove unnecessary conditionals before
+	nis_freeresult calls.
+	* nis/nis_ismember.c: Likewise.
+
+	* elf/rtld.c (process_envvars): Fix handling of LD_POINTER_GUARD.
+	Reported by genesh@comcast.net.
+
+	* io/fts.c (fts_build): Call fts_lfree in the two error cases
+	after the loop [Coverity CID 187].
+
+	* nis/nis_getservlist.c (nis_getservlist): Also free lookup result
+	in error case [Coverity CID 189].
+
+	* nis/nis_getservlist.c (nis_getservlist): One more free call
+	needed [Coverity CID 190].
+
+2006-04-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/generic/unwind-dw2-fde.c (end_fde_sort): Remove
+	unnecessary test for accu->linear == NULL [Coverity CID 79].
+
+2006-04-07  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/posix/tempname.c (__gen_tempname): Change attempts_min
+	into a macro.  Use preprocessor to decide how to initialize
+	attempts [Coverity CID 67].
+
+	* io/fts.c (fts_build): Comment out dead code [Coverity CID 68].
+
+	* sunrpc/rpc_parse.c (def_union): Comment out dead code
+	[Coverity CID 70].
+
+	* locale/programs/linereader.c (lr_token): Remove duplicate
+	handling of EOF [Coverity CID 71].
+
+	* locale/programs/ld-numeric.c (numeric_read) [case tok_grouping]:
+	We bail out early if ignore_content is set, so there is no need to
+	check it later again [Coverity CID 72].
+
+	* inet/inet6_option.c (inet6_option_find): Check *tptrp for NULL,
+	not tptrp [Coverity CID 73].
+
+	* inet/inet6_option.c (inet6_option_next): Check *tptrp for NULL,
+	not tptrp [Coverity CID 74].
+
+	* misc/tsearch.c (__tsearch): Don't rotate tree if memory
+	allocation failed [Coverity CID 78].
+
+2006-04-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/generic/unwind-dw2.c (execute_cfa_program): Fix typo in
+	the last change.
+
+2006-04-07  Ulrich Drepper  <drepper@redhat.com>
+
+	* inet/rexec.c (rexec_af): If we have no canonical name don't
+	proceed further [Coverity CID 86].
+
+	* iconv/iconv_charmap.c (process_fd): Initialize inptr from inbuf,
+	not to NULL [Coverity CID 88].
+
+2006-04-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/ldconfig.c (main): Use rawmemchr instead of strchr.
+	* nis/nis_call.c (rec_dirsearch): Likewise.
+	* nis/nis_local_names.c (nis_local_host): Likewise.
+	(nis_local_directory): Likewise.
+	* intl/explodename.c (_nl_explode_name): Likewise.
+
+	* sysdeps/generic/unwind-dw2.c (execute_cfa_program): Don't handle
+	DW_CFA_GNU_window_save if it obviously cannot work [Coverity CID 102].
+
+	* locale/programs/ld-address.c (address_finish): Fix conditions
+	for error messages [Coverity CID 104].
+
+	* libio/fmemopen.c (fmemopen): Free stream memory in case of
+	invalid length [Coverity CID 106].
+
+	* nss/nss_files/files-key.c (search): Close stream before
+	successful return [Coverity CID 107].
+
+	* io/fts.c (fts_open): Don't allocate parent if *argv==NULL
+	[Coverity CID 108].
+
+	* sunrpc/rpc_cout.c (inline_struct): Free sizestr after use
+	[Coverity CID 110, 109].
+
+	* sunrpc/rpc_scan.c (docppline): Free file string if it is not
+	going to be used [Coverity CID 111].
+
+	* sysdeps/unix/sysv/linux/getsourcefilter.c (getsourcefilter): Free
+	memory if socket level value cannot be retrieved [Coverity CID 112].
+
+	* nis/nis_clone_dir.c (nis_clone_directory): Free all memory in
+	error case [Coverity CID 114].
+
+	* nis/nis_clone_res.c (nis_clone_result): Free all memory in the
+	error cases [Coverity CID 115].
+
+	* sunrpc/rpc_parse.c (get_definition): Free defp if tok ==
+	TOK_EOF [Coverity CID 116].
+
+	* sysdeps/unix/sysv/linux/setsourcefilter.c (setsourcefilter): Free
+	memory if socket level value cannot be retrieved [Coverity CID 117].
+
+	* elf/cache.c (save_cache): Initialize pad to avoid writing
+	uninitialized data to disk.
+
+	* elf/cache.c (save_cache): Free file_entries_new [Coverity CID 118].
+
+	* intl/finddomain.c (_nl_find_domain): Avoid strdup of expand
+	locale name, use strdupa.  Remove free call [Coverity CID 119].
+
+	* sunrpc/rpc_main.c (generate_guard): Avoid extra allocation and
+	the resulting leak [Coverity CID 121].
+
+	* sunrpc/rpc_main.c (mkfile_output): Free all allocated memory
+	[Coverity CID 122].
+
+	* sunrpc/rpc_main.c (h_output): Free guard after we are done
+	[Coverity CID 123].
+
+	* sunrpc/svc_udp.c (cache_set): Free victim if newbuf allocation
+	fails [Coverity CID 126].
+
+	* sunrpc/svc_udp.c (svcudp_enablecache): Free memory in error
+	cases [Coverity CID 127].
+
+	* nis/nis_table.c (__create_ib_request): Free ibreq in case strdup
+	fails [Coverity CID 128].
+
+	* nis/nis_getservlist.c (nis_getservlist): Free all memory in case
+	of an error [Coverity CID 130, 129].
+
+	* nis/nis_print_group_entry.c (nis_print_group_entry): If
+	nis_lookup call failed, return.  Free lookup result in error
+	cases [Coverity CID 131].
+
+	* nis/nis_removemember.c (nis_removemember): Free all memory in
+	error cases [Coverity CID 132].
+
+	* nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r):
+	Always free lookup result [Coverity CID 134].
+
+	* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_gethostton_r):
+	Always free lookup result [Coverity CID 135].
+
+	* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_getntohost_r):
+	Always free lookup result [Coverity CID 136].
+
+	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyaddr_r):
+	Before retrying, free old result [Coverity CID 137].
+
+	* nis/nss_nisplus/nisplus-publickey.c (_nss_nisplus_netname2user):
+	Free res in case UID is zero [Coverity CID 138].
+
+	* nis/ypclnt.c (yp_update): Always free master string
+	[Coverity CID 140].
+
+	* nis/nis_creategroup.c (nis_creategroup): Free all memory in
+	error cases [Coverity CID 143, 142, 141].
+
+	* nis/nss_nis/nis-publickey.c (_nss_nis_getpublickey): Free result
+	if yp_match call succeeded [Coverity CID 155].
+
+	* nis/nss_nis/nis-publickey.c (_nss_nis_getsecretkey): Free string
+	allocated in yp_match at all times [Coverity CID 157, 156].
+
+	* nscd/nscd.c (write_pid): Close stream also if writing failed
+	[Coverity CID 165].
+
+	* nis/nis_table.c (nis_add_entry): Move test for NULL parameter
+	ahead of first use [Coverity CID 167].
+
+	* nis/nss_nis/nis-alias.c (_nss_nis_getaliasbyname_r): Move test
+	for NULL parameter ahead of first use [Coverity CID 168].
+
+	* intl/finddomain.c (_nl_find_domain): We never return NULL if we
+	found the locale [Coverity CID 169].
+
+	* inet/getnameinfo.c (getnameinfo): __getservbyport_r does not set
+	herrno [Coverity CID 178].
+
+	* nis/nis_checkpoint.c (nis_checkpoint): Don't access and returned
+	freed object [Coverity CID 182].
+
+2006-04-05  Alan Modra  <amodra@bigpond.net.au>
+	    Jakub Jelinek  <jakub@redhat.com>
+
+	* posix/bits/unistd.h (readlink, __readlink_chk, __readlink_alias):
+	Change return value to ssize_t.
+
+2006-04-04  Roland McGrath  <roland@redhat.com>
+
+	* string/Makefile (CFLAGS-inl-tester.c): New variable.
+	(CFLAGS-tst-inlcall.c): Likewise.
+
+	[BZ #2508]
+	* nscd/Makefile ($(objpfx)nscd_stat.o: sysincludes): Move setting
+	inside [$(have-selinux) = yes].
+	($(objpfx)selinux.o: sysincludes): Likewise.
+
+	* iconvdata/Makefile (generate-8bit-table): Use LC_ALL=C.
+	(generate-8bit-gap-table): Likewise.
+	($(objpfx)iso8859-7jp.stmp): Likewise.
+	Reported by S.Çağlar Onur <caglar@uludag.org.tr>.
+
+2006-03-21  Joseph S. Myers  <joseph@codesourcery.com>
+
+	* soft-fp/adddf3.c: Add libgcc exception.  Update FSF address.
+	* soft-fp/addsf3.c: Likewise.
+	* soft-fp/addtf3.c: Likewise.
+	* soft-fp/divdf3.c: Likewise.
+	* soft-fp/divsf3.c: Likewise.
+	* soft-fp/divtf3.c: Likewise.
+	* soft-fp/double.h: Likewise.
+	* soft-fp/eqdf2.c: Likewise.
+	* soft-fp/eqsf2.c: Likewise.
+	* soft-fp/eqtf2.c: Likewise.
+	* soft-fp/extenddftf2.c: Likewise.
+	* soft-fp/extended.h: Likewise.
+	* soft-fp/extendsfdf2.c: Likewise.
+	* soft-fp/extendsftf2.c: Likewise.
+	* soft-fp/fixdfdi.c: Likewise.
+	* soft-fp/fixdfsi.c: Likewise.
+	* soft-fp/fixsfdi.c: Likewise.
+	* soft-fp/fixsfsi.c: Likewise.
+	* soft-fp/fixtfdi.c: Likewise.
+	* soft-fp/fixtfsi.c: Likewise.
+	* soft-fp/fixunsdfdi.c: Likewise.
+	* soft-fp/fixunsdfsi.c: Likewise.
+	* soft-fp/fixunssfdi.c: Likewise.
+	* soft-fp/fixunssfsi.c: Likewise.
+	* soft-fp/fixunstfdi.c: Likewise.
+	* soft-fp/fixunstfsi.c: Likewise.
+	* soft-fp/floatdidf.c: Likewise.
+	* soft-fp/floatdisf.c: Likewise.
+	* soft-fp/floatditf.c: Likewise.
+	* soft-fp/floatsidf.c: Likewise.
+	* soft-fp/floatsisf.c: Likewise.
+	* soft-fp/floatsitf.c: Likewise.
+	* soft-fp/floatundidf.c: Likewise.
+	* soft-fp/floatundisf.c: Likewise.
+	* soft-fp/floatunditf.c: Likewise.
+	* soft-fp/floatunsidf.c: Likewise.
+	* soft-fp/floatunsisf.c: Likewise.
+	* soft-fp/floatunsitf.c: Likewise.
+	* soft-fp/gedf2.c: Likewise.
+	* soft-fp/gesf2.c: Likewise.
+	* soft-fp/getf2.c: Likewise.
+	* soft-fp/ledf2.c: Likewise.
+	* soft-fp/lesf2.c: Likewise.
+	* soft-fp/letf2.c: Likewise.
+	* soft-fp/muldf3.c: Likewise.
+	* soft-fp/mulsf3.c: Likewise.
+	* soft-fp/multf3.c: Likewise.
+	* soft-fp/negdf2.c: Likewise.
+	* soft-fp/negsf2.c: Likewise.
+	* soft-fp/negtf2.c: Likewise.
+	* soft-fp/op-1.h: Likewise.
+	* soft-fp/op-2.h: Likewise.
+	* soft-fp/op-4.h: Likewise.
+	* soft-fp/op-8.h: Likewise.
+	* soft-fp/op-common.h: Likewise.
+	* soft-fp/quad.h: Likewise.
+	* soft-fp/single.h: Likewise.
+	* soft-fp/soft-fp.h: Likewise.
+	* soft-fp/sqrtdf2.c: Likewise.
+	* soft-fp/sqrtsf2.c: Likewise.
+	* soft-fp/sqrttf2.c: Likewise.
+	* soft-fp/subdf3.c: Likewise.
+	* soft-fp/subsf3.c: Likewise.
+	* soft-fp/subtf3.c: Likewise.
+	* soft-fp/truncdfsf2.c: Likewise.
+	* soft-fp/trunctfdf2.c: Likewise.
+	* soft-fp/trunctfsf2.c: Likewise.
+	* soft-fp/unorddf2.c: Likewise.
+	* soft-fp/unordsf2.c: Likewise.
+	* soft-fp/unordtf2.c: Likewise.
+
+2006-04-03  Steven Munroe  <sjmunroe@us.ibm.com>
+
+	[BZ #2505]
+	* sysdeps/powerpc/powerpc32/bits/atomic.h [_ARCH_PWR4]:
+	Define atomic_read_barrier and __ARCH_REL_INSTR using lwsync.
+
+2006-04-03  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Terminate FDE
+	before syscall.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise.
+
+	* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h: Test for <asm/elf.h>
+	with [! _ASM_POWERPC_ELF_H] as well as [!__PPC64_ELF_H].
+
+2006-04-03  Roland McGrath  <roland@frob.com>
+
+	[BZ #2507]
+	* mach/Machrules (.udeps-targets): New variable.
+	($(objpfx)%.udeps static pattern rule): Use it to avoid \ inside
+	quoted string.
+
+2006-04-02  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #2501]
+	* nscd/nscd_helper.c (get_mapping): Rewrite code to send request
+	so it uses send and not writev.
+
+	[BZ #2418]
+	* sysdeps/unix/sysv/linux/bits/socket.h: Use larger of PATH_MAX and
+	page size when allocating buffer.
+
+2006-04-01  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #2415]
+	* elf/ldd.bash.in: Create better error messages for invalid input
+	files.
+
+	[BZ #2477]
+	* sysdeps/unix/sysv/linux/i386/sysdep.h: Create correct LOADARGS_*
+	macros for non-shared position-independent code.
+
+	[BZ #2472]
+	* bits/siginfo.h: Fix typo in ILL_ILLOPN definition.
+
+	[BZ #2450]
+	* posix/unistd.h: Match return value of readlink to what POSIX
+	says these days.
+	* io/readlink.c: Likewise.
+	* io/readlinkat.c: Likewise.
+	* sysdeps/unix/sysv/linux/readlinkat.c: Likewise.
+
+	[BZ #2498]
+	* nscd/connections.c (main_loop_poll): If the connection cannot be
+	accepted because of user-imposed limits close the descriptor.
+
+2006-03-31  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/Versions: Export sync_file_range with
+	GLIBC_2.5.
+	* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Remove
+	LINUX_FADV_ASYNC_WRITE and LINUX_FADV_WRITE_WAIT.
+	Declare sync_file_range and splice.
+	* sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Add
+	sync_file_range.
+	* sysdeps/unix/sysv/linux/i386/sync_file_range.S: New file.
+	* sysdeps/unix/sysv/linux/syscalls.list: Add splice syscall.
+	* sysdeps/unix/sysv/linux/Versions: Export splice with GLIBC_2.5
+	version.
+	* Versions.def: Define GLIBC_2.5 for libc.
+
+2006-03-29  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): No need to duplicate
+	'name' for 'canon'.  The final allocation will happen later.
+
 2006-03-27  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/kernel-features.h: Remove support for
@@ -6165,7 +6681,7 @@
 2005-11-28  Andreas Jaeger  <aj@suse.de>
 
 	* sysdeps/unix/sysv/linux/mips/bits/mman.h (MREMAP_FIXED): Added,
-	Patch by René Rebe <rene@exactcode.de>.
+	Patch by René Rebe <rene@exactcode.de>.
 
 2005-11-27  Ulrich Drepper  <drepper@redhat.com>
 
@@ -6177,7 +6693,7 @@
 2005-11-27  Roland McGrath  <roland@redhat.com>
 
 	* sysdeps/unix/sysv/linux/fchownat.c: Include alloca.h, sysdep.h.
-	Reported by René Rebe <rene@exactcode.de>.
+	Reported by René Rebe <rene@exactcode.de>.
 
 2005-11-27  Ulrich Drepper  <drepper@redhat.com>
 
diff --git a/NEWS b/NEWS
index c47a9772c6..eff3b48a31 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,18 @@
-GNU C Library NEWS -- history of user-visible changes.  2006-03-01
+GNU C Library NEWS -- history of user-visible changes.  2006-04-16
 Copyright (C) 1992-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
 using `glibc' in the "product" field.
 
+Version 2.5
+
+* For Linux, the sorting of addresses returned by getaddrinfo now also
+  handles rules 3 and 7 from RFC 3484.  Implemented by Ulrich Drepper.
+
+* New Linux interfaces: splice, tee, sync_file_range.
+
+
 Version 2.4
 
 * More overflow detection functions.
diff --git a/Versions.def b/Versions.def
index 062a94730d..b492caaf0b 100644
--- a/Versions.def
+++ b/Versions.def
@@ -21,6 +21,7 @@ libc {
   GLIBC_2.3.3
   GLIBC_2.3.4
   GLIBC_2.4
+  GLIBC_2.5
 %ifdef USE_IN_LIBIO
   HURD_CTHREADS_0.3
 %endif
diff --git a/argp/argp.h b/argp/argp.h
index f310193458..3a5cb01fd8 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing, layered over getopt.
-   Copyright (C) 1995-1999,2003,2004,2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <getopt.h>
+#include <limits.h>
 
 #define __need_error_t
 #include <errno.h>
@@ -574,7 +575,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt))
   else
     {
       int __key = __opt->key;
-      return __key > 0 && isprint (__key);
+      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
     }
 }
 
diff --git a/bits/siginfo.h b/bits/siginfo.h
index fe7b3b5f9c..241033b7cd 100644
--- a/bits/siginfo.h
+++ b/bits/siginfo.h
@@ -76,7 +76,7 @@ enum
 {
   ILL_ILLOPC = 1,		/* Illegal opcode.  */
 # define ILL_ILLOPC	ILL_ILLOPC
-  ILL_ILL_OPN,			/* Illegal operand.  */
+  ILL_ILLOPN,			/* Illegal operand.  */
 # define ILL_ILLOPN	ILL_ILLOPN
   ILL_ILLADR,			/* Illegal addressing mode.  */
 # define ILL_ILLADR	ILL_ILLADR
diff --git a/elf/cache.c b/elf/cache.c
index 9462ac1b53..6730fb36eb 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1999,2000,2001,2002,2003,2005
-	Free Software Foundation, Inc.
+/* Copyright (C) 1999-2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -421,7 +420,7 @@ save_cache (const char *cache_name)
   if (opt_format != 2)
     {
       if (write (fd, file_entries, file_entries_size)
-	  != (ssize_t)file_entries_size)
+	  != (ssize_t) file_entries_size)
 	error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
     }
   if (opt_format != 0)
@@ -430,15 +429,16 @@ save_cache (const char *cache_name)
       if (opt_format != 2)
 	{
 	  char zero[pad];
-	  if (write (fd, zero, pad) != (ssize_t)pad)
+	  memset (zero, '\0', pad);
+	  if (write (fd, zero, pad) != (ssize_t) pad)
 	    error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
 	}
       if (write (fd, file_entries_new, file_entries_new_size)
-	  != (ssize_t)file_entries_new_size)
+	  != (ssize_t) file_entries_new_size)
 	error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
     }
 
-  if (write (fd, strings, total_strlen) != (ssize_t)total_strlen)
+  if (write (fd, strings, total_strlen) != (ssize_t) total_strlen)
     error (EXIT_FAILURE, errno, _("Writing of cache data failed."));
 
   close (fd);
@@ -455,6 +455,7 @@ save_cache (const char *cache_name)
 	   cache_name);
 
   /* Free all allocated memory.  */
+  free (file_entries_new);
   free (file_entries);
   free (strings);
 
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 795fe6374f..6800272ac7 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1205,7 +1205,7 @@ main (int argc, char **argv)
   if (opt_chroot)
     {
       /* Normalize the path a bit, we might need it for printing later.  */
-      char *endp = strchr (opt_chroot, '\0');
+      char *endp = rawmemchr (opt_chroot, '\0');
       while (endp > opt_chroot && endp[-1] == '/')
 	--endp;
       *endp = '\0';
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index 100d2335d2..a22ad15b59 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -144,9 +144,12 @@ for file do
   *) file=./$file
      ;;
   esac
-  if test ! -f "$file"; then
+  if test ! -e "$file"; then
     echo "ldd: ${file}:" $"No such file or directory" >&2
     result=1
+  elif test ! -f "$file"; then
+    echo "ldd: ${file}:" $"not regular file" >&2
+    result=1
   elif test -r "$file"; then
     test -x "$file" || echo 'ldd:' $"\
 warning: you do not have execution permission for" "\`$file'" >&2
diff --git a/elf/rtld.c b/elf/rtld.c
index 68fe809700..9a21b8bc6f 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2624,7 +2624,7 @@ process_envvars (enum mode *modep)
 	    }
 
 	  if (memcmp (envline, "POINTER_GUARD", 13) == 0)
-	    GLRO(dl_pointer_guard) = envline[14] == '0';
+	    GLRO(dl_pointer_guard) = envline[14] != '0';
 	  break;
 
 	case 14:
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 9f35fe0f79..30b137b955 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-fc4
-fedora-sync-date := 2006-03-28 09:00 UTC
-fedora-sync-tag := fedora-glibc-20060328T0900
+fedora-sync-date := 2006-04-24 08:20 UTC
+fedora-sync-tag := fedora-glibc-20060424T0820
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 987ee270cb..0f38af7f11 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -295,7 +295,6 @@ cat > override_headers/asm/unistd.h <<EOF
 #define __NR_mknodat		297
 #define __NR_fchownat		298
 #define __NR_futimesat		299
-#define __NR_fstatat64		300
 #define __NR_unlinkat		301
 #define __NR_renameat		302
 #define __NR_linkat		303
@@ -304,6 +303,9 @@ cat > override_headers/asm/unistd.h <<EOF
 #define __NR_fchmodat		306
 #define __NR_faccessat		307
 #endif
+#ifndef __NR_fstatat64
+#define __NR_fstatat64		300
+#endif
 #ifndef __NR_pselect6
 #define __NR_pselect6		308
 #define __NR_ppoll		309
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
index b83081efca..328121edbe 100644
--- a/iconv/iconv_charmap.c
+++ b/iconv/iconv_charmap.c
@@ -1,5 +1,5 @@
 /* Convert using charmaps and possibly iconv().
-   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -488,7 +488,7 @@ process_fd (struct convtable *tbl, int fd, FILE *output)
      process it in one step.  */
   static char *inbuf = NULL;
   static size_t maxlen = 0;
-  char *inptr = NULL;
+  char *inptr = inbuf;
   size_t actlen = 0;
 
   while (actlen < maxlen)
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 39eb1e3863..1c80df16cf 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1997-2004,2005,2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -255,14 +255,14 @@ export AWK
 
 define generate-8bit-table
 $(make-target-directory)
-$(SHELL) ./gen-8bit.sh $< > $(@:stmp=T)
+LC_ALL=C $(SHELL) ./gen-8bit.sh $< > $(@:stmp=T)
 $(move-if-change) $(@:stmp=T) $(@:stmp=h)
 touch $@
 endef
 
 define generate-8bit-gap-table
 $(make-target-directory)
-$(SHELL) ./gen-8bit-gap.sh $< > $(@:stmp=T)
+LC_ALL=C $(SHELL) ./gen-8bit-gap.sh $< > $(@:stmp=T)
 $(move-if-change) $(@:stmp=T) $(@:stmp=h)
 touch $@
 endef
@@ -304,7 +304,7 @@ $(gen-8bit-gap-modules:%=$(objpfx)%.stmp): $(objpfx)%.stmp: $(objpfx)iconv-rules
 
 $(objpfx)iso8859-7jp.stmp: $(charmaps)/ISO-8859-7 gen-8bit-gap-1.sh
 	$(make-target-directory)
-	$(SHELL) ./gen-8bit-gap-1.sh $< > $(@:stmp=T)
+	LC_ALL=C $(SHELL) ./gen-8bit-gap-1.sh $< > $(@:stmp=T)
 	$(move-if-change) $(@:stmp=T) $(@:stmp=h)
 	touch $@
 
diff --git a/iconvdata/ibm437.c b/iconvdata/ibm437.c
index 2bec8c1223..38955c8477 100644
--- a/iconvdata/ibm437.c
+++ b/iconvdata/ibm437.c
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM437.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -24,6 +24,6 @@
 #define TABLES <ibm437.h>
 
 #define CHARSET_NAME	"IBM437//"
-#define HAS_HOLES	1	/* Not all 256 character are defined.  */
+#define HAS_HOLES	0	/* All 256 character are defined.  */
 
 #include <8bit-gap.c>
diff --git a/iconvdata/ibm861.c b/iconvdata/ibm861.c
index 78a6528e1f..f9f46d299e 100644
--- a/iconvdata/ibm861.c
+++ b/iconvdata/ibm861.c
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM861.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -24,6 +24,6 @@
 #define TABLES <ibm861.h>
 
 #define CHARSET_NAME	"IBM861//"
-#define HAS_HOLES	1	/* Not all 256 character are defined.  */
+#define HAS_HOLES	0	/* All 256 character are defined.  */
 
 #include <8bit-gap.c>
diff --git a/iconvdata/ibm862.c b/iconvdata/ibm862.c
index 447c87829e..2b0a27995b 100644
--- a/iconvdata/ibm862.c
+++ b/iconvdata/ibm862.c
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM862.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -24,6 +24,6 @@
 #define TABLES <ibm862.h>
 
 #define CHARSET_NAME	"IBM862//"
-#define HAS_HOLES	1	/* Not all 256 character are defined.  */
+#define HAS_HOLES	0	/* All 256 character are defined.  */
 
 #include <8bit-gap.c>
diff --git a/iconvdata/ibm863.c b/iconvdata/ibm863.c
index 68aac4caad..1af36d6469 100644
--- a/iconvdata/ibm863.c
+++ b/iconvdata/ibm863.c
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM863.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -24,6 +24,6 @@
 #define TABLES <ibm863.h>
 
 #define CHARSET_NAME	"IBM863//"
-#define HAS_HOLES	1	/* Not all 256 character are defined.  */
+#define HAS_HOLES	0	/* All 256 character are defined.  */
 
 #include <8bit-gap.c>
diff --git a/iconvdata/ibm865.c b/iconvdata/ibm865.c
index a81a95af44..4b3007713b 100644
--- a/iconvdata/ibm865.c
+++ b/iconvdata/ibm865.c
@@ -1,5 +1,5 @@
 /* Conversion from and to IBM865.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -24,6 +24,6 @@
 #define TABLES <ibm865.h>
 
 #define CHARSET_NAME	"IBM865//"
-#define HAS_HOLES	1	/* Not all 256 character are defined.  */
+#define HAS_HOLES	0	/* All 256 character are defined.  */
 
 #include <8bit-gap.c>
diff --git a/include/ifaddrs.h b/include/ifaddrs.h
index aa20c35101..d790fcbe87 100644
--- a/include/ifaddrs.h
+++ b/include/ifaddrs.h
@@ -1,10 +1,22 @@
 #ifndef _IFADDRS_H
 #include <inet/ifaddrs.h>
 #include <stdbool.h>
+#include <stdint.h>
 
 libc_hidden_proto (getifaddrs)
 libc_hidden_proto (freeifaddrs)
 
-extern void __check_pf (bool *seen_ipv4, bool *seen_ipv6) attribute_hidden;
+struct in6addrinfo
+{
+  enum {
+    in6ai_deprecated = 1,
+    in6ai_temporary = 2
+  } flags;
+  uint32_t addr[4];
+};
+
+extern void __check_pf (bool *seen_ipv4, bool *seen_ipv6,
+			struct in6addrinfo **in6ai, size_t *in6ailen)
+  attribute_hidden;
 
 #endif	/* ifaddrs.h */
diff --git a/inet/check_pf.c b/inet/check_pf.c
index 5d98c98aff..b015432659 100644
--- a/inet/check_pf.c
+++ b/inet/check_pf.c
@@ -1,5 +1,5 @@
 /* Determine protocol families for which interfaces exist.  Generic version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,8 +23,14 @@
 
 void
 attribute_hidden
-__check_pf (bool *seen_ipv4, bool *seen_ipv6)
+__check_pf (bool *seen_ipv4, bool *seen_ipv6,
+	    struct in6addrinfo **in6ai, size_t *in6ailen)
 {
+  /* By default we have no way to determine information about
+     deprecated and temporary addresses.  */
+  *in6ai = NULL;
+  *in6ailen = 0;
+
   /* Get the interface list via getifaddrs.  */
   struct ifaddrs *ifa = NULL;
   if (getifaddrs (&ifa) != 0)
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 493a423c10..5057fd221a 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -403,25 +403,16 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 	if (!(flags & NI_NUMERICSERV))
 	  {
 	    struct servent *s, ts;
-	    while (__getservbyport_r (((const struct sockaddr_in *) sa)->sin_port,
-				      ((flags & NI_DGRAM) ? "udp" : "tcp"),
-				      &ts, tmpbuf, tmpbuflen, &s))
+	    int e;
+	    while ((e = __getservbyport_r (((const struct sockaddr_in *) sa)->sin_port,
+					   ((flags & NI_DGRAM)
+					    ? "udp" : "tcp"),
+					   &ts, tmpbuf, tmpbuflen, &s)))
 	      {
-		if (herrno == NETDB_INTERNAL)
-		  {
-		    if (errno == ERANGE)
-		      tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
-					      2 * tmpbuflen);
-		    else
-		      {
-			__set_errno (serrno);
-			return EAI_SYSTEM;
-		      }
-		  }
+		if (e == ERANGE)
+		  tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
 		else
-		  {
-		    break;
-		  }
+		  break;
 	      }
 	    if (s)
 	      {
diff --git a/inet/inet6_option.c b/inet/inet6_option.c
index 2e0fed8a30..f88982e323 100644
--- a/inet/inet6_option.c
+++ b/inet/inet6_option.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -251,7 +251,7 @@ inet6_option_next (cmsg, tptrp)
   const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
 
   const uint8_t *result;
-  if (tptrp == NULL)
+  if (*tptrp == NULL)
     /* This is the first call, return the first option if there is one.  */
     result = (const uint8_t *) (ip6e + 1);
   else
@@ -308,7 +308,7 @@ inet6_option_find (cmsg, tptrp, type)
   const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
 
   const uint8_t *next;
-  if (tptrp == NULL)
+  if (*tptrp == NULL)
     /* This is the first call, return the first option if there is one.  */
     next = (const uint8_t *) (ip6e + 1);
   else
diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c
index 889435dd10..38794957c2 100644
--- a/inet/inet_ntoa.c
+++ b/inet/inet_ntoa.c
@@ -21,78 +21,19 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <arpa/inet.h>
-#include <bits/libc-lock.h>
 
 /* The interface of this function is completely stupid, it requires a
-   static buffer.  We relax this a bit in that we allow at least one
-   buffer for each thread.  */
-
-/* This is the key for the thread specific memory.  */
-static __libc_key_t key;
-
-/* If nonzero the key allocation failed and we should better use a
-   static buffer than fail.  */
-static char local_buf[18];
-static char *static_buf;
-
-/* Destructor for the thread-specific data.  */
-static void init (void);
-static void free_key_mem (void *mem);
+   static buffer.  We relax this a bit in that we allow one buffer for
+   each thread.  */
+static __thread char buffer[18];
 
 
 char *
 inet_ntoa (struct in_addr in)
 {
-  __libc_once_define (static, once);
-  char *buffer;
-  unsigned char *bytes;
-
-  /* If we have not yet initialized the buffer do it now.  */
-  __libc_once (once, init);
-
-  if (static_buf != NULL)
-    buffer = static_buf;
-  else
-    {
-      /* We don't use the static buffer and so we have a key.  Use it
-	 to get the thread-specific buffer.  */
-      buffer = __libc_getspecific (key);
-      if (buffer == NULL)
-	{
-	  /* No buffer allocated so far.  */
-	  buffer = malloc (18);
-	  if (buffer == NULL)
-	    /* No more memory available.  We use the static buffer.  */
-	    buffer = local_buf;
-	  else
-	    __libc_setspecific (key, buffer);
-	}
-    }
-
-  bytes = (unsigned char *) &in;
-  __snprintf (buffer, 18, "%d.%d.%d.%d",
+  unsigned char *bytes = (unsigned char *) &in;
+  __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d",
 	      bytes[0], bytes[1], bytes[2], bytes[3]);
 
   return buffer;
 }
-
-
-/* Initialize buffer.  */
-static void
-init (void)
-{
-  if (__libc_key_create (&key, free_key_mem))
-    /* Creating the key failed.  This means something really went
-       wrong.  In any case use a static buffer which is better than
-       nothing.  */
-    static_buf = local_buf;
-}
-
-
-/* Free the thread specific data, this is done if a thread terminates.  */
-static void
-free_key_mem (void *mem)
-{
-  free (mem);
-  __libc_setspecific (key, NULL);
-}
diff --git a/inet/rexec.c b/inet/rexec.c
index 6deb1feb45..07ddeeafea 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -87,8 +87,11 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af)
 			return (-1);
 		}
 		*ahost = ahostbuf;
-	} else
+	} else {
 		*ahost = NULL;
+		__set_errno (ENOENT);
+		return -1;
+	}
 	ruserpass(res0->ai_canonname, &name, &pass);
 retry:
 	s = __socket(res0->ai_family, res0->ai_socktype, 0);
diff --git a/intl/explodename.c b/intl/explodename.c
index f7bcfa5ff6..8e326ead53 100644
--- a/intl/explodename.c
+++ b/intl/explodename.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -78,7 +78,7 @@ _nl_explode_name (name, language, modifier, territory, codeset,
   if (*language == cp)
     /* This does not make sense: language has to be specified.  Use
        this entry as it is without exploding.  Perhaps it is an alias.  */
-    cp = strchr (*language, '\0');
+    cp = __rawmemchr (*language, '\0');
   else if (cp[0] != '@')
     {
       if (cp[0] == '_')
diff --git a/intl/finddomain.c b/intl/finddomain.c
index 39e54755d2..9806ba12cd 100644
--- a/intl/finddomain.c
+++ b/intl/finddomain.c
@@ -1,5 +1,5 @@
 /* Handle list of needed message catalogs
-   Copyright (C) 1995-1999, 2000, 2001, 2002, 2004
+   Copyright (C) 1995-1999, 2000, 2001, 2002, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -110,7 +110,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
 	    break;
 	}
 
-      return cnt >= 0 ? retval : NULL;
+      return retval;
       /* NOTREACHED */
     }
 
@@ -119,20 +119,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
      done.  */
   alias_value = _nl_expand_alias (locale);
   if (alias_value != NULL)
-    {
-#if defined _LIBC || defined HAVE_STRDUP
-      locale = strdup (alias_value);
-      if (locale == NULL)
-	return NULL;
-#else
-      size_t len = strlen (alias_value) + 1;
-      locale = (char *) malloc (len);
-      if (locale == NULL)
-	return NULL;
-
-      memcpy (locale, alias_value, len);
-#endif
-    }
+    locale = strdupa (alias_value);
 
   /* Now we determine the single parts of the locale name.  First
      look for the language.  Termination symbols are `_' and `@' if
@@ -169,10 +156,6 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
 	}
     }
 
-  /* The room for an alias was dynamically allocated.  Free it now.  */
-  if (alias_value != NULL)
-    free (locale);
-
   /* The space for normalized_codeset is dynamically allocated.  Free it.  */
   if (mask & XPG_NORM_CODESET)
     free ((void *) normalized_codeset);
diff --git a/io/fts.c b/io/fts.c
index 2b99206b88..6383fe8f17 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -93,7 +93,8 @@ fts_open(argv, options, compar)
 	register FTS *sp;
 	register FTSENT *p, *root;
 	register int nitems;
-	FTSENT *parent, *tmp;
+	FTSENT *parent = NULL;
+	FTSENT *tmp;
 
 	/* Options check. */
 	if (options & ~FTS_OPTIONMASK) {
@@ -124,9 +125,11 @@ fts_open(argv, options, compar)
 		goto mem1;
 
 	/* Allocate/initialize root's parent. */
-	if ((parent = fts_alloc(sp, "", 0)) == NULL)
-		goto mem2;
-	parent->fts_level = FTS_ROOTPARENTLEVEL;
+	if (*argv != NULL) {
+		if ((parent = fts_alloc(sp, "", 0)) == NULL)
+			goto mem2;
+		parent->fts_level = FTS_ROOTPARENTLEVEL;
+	  }
 
 	/* Allocate/initialize root(s). */
 	for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
@@ -744,6 +747,10 @@ mem1:				saved_errno = errno;
 			p->fts_flags |= FTS_ISW;
 #endif
 
+#if 0
+		/* Unreachable code.  cderrno is only ever set to a nonnull
+		   value if dirp is closed at the same time.  But then we
+		   cannot enter this loop.  */
 		if (cderrno) {
 			if (nlinks) {
 				p->fts_info = FTS_NS;
@@ -751,7 +758,9 @@ mem1:				saved_errno = errno;
 			} else
 				p->fts_info = FTS_NSOK;
 			p->fts_accpath = cur->fts_accpath;
-		} else if (nlinks == 0
+		} else
+#endif
+		if (nlinks == 0
 #if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
 			   || (nostat &&
 			       dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
@@ -819,6 +828,7 @@ mem1:				saved_errno = errno;
 	     fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
 		cur->fts_info = FTS_ERR;
 		SET(FTS_STOP);
+		fts_lfree(head);
 		return (NULL);
 	}
 
@@ -826,6 +836,7 @@ mem1:				saved_errno = errno;
 	if (!nitems) {
 		if (type == BREAD)
 			cur->fts_info = FTS_DP;
+		fts_lfree(head);
 		return (NULL);
 	}
 
diff --git a/io/readlink.c b/io/readlink.c
index 779b809eaa..b69d08695c 100644
--- a/io/readlink.c
+++ b/io/readlink.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@
 /* Read the contents of the symbolic link PATH into no more than
    LEN bytes of BUF.  The contents are not null-terminated.
    Returns the number of characters read, or -1 for errors.  */
-int
+ssize_t
 __readlink (path, buf, len)
      const char *path;
      char *buf;
diff --git a/io/readlinkat.c b/io/readlinkat.c
index c6a032c474..483dc4914d 100644
--- a/io/readlinkat.c
+++ b/io/readlinkat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@
 /* Read the contents of the symbolic link PATH relative to FD into no
    more than LEN bytes of BUF.  The contents are not null-terminated.
    Returns the number of characters read, or -1 for errors.  */
-int
+ssize_t
 readlinkat (fd, path, buf, len)
      int fd;
      const char *path;
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index b847f62c9a..f3b280092c 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -1,5 +1,5 @@
 /* Fmemopen implementation.
-   Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by  Hanno Mueller, kontakt@hanno.de, 2000.
 
@@ -202,7 +202,7 @@ fmemopen (void *buf, size_t len, const char *mode)
   cookie_io_functions_t iof;
   fmemopen_cookie_t *c;
 
-  if (len == 0)
+  if (__builtin_expect (len == 0, 0))
     {
     einval:
       __set_errno (EINVAL);
@@ -227,8 +227,11 @@ fmemopen (void *buf, size_t len, const char *mode)
     }
   else
     {
-      if ((uintptr_t) len > -(uintptr_t) buf)
-	goto einval;
+      if (__builtin_expect ((uintptr_t) len > -(uintptr_t) buf, 0))
+	{
+	  free (c);
+	  goto einval;
+	}
 
       c->buffer = buf;
     }
diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c
index 4d649b0456..83cd9fa17b 100644
--- a/locale/programs/ld-address.c
+++ b/locale/programs/ld-address.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2002, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2002, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -222,14 +222,18 @@ No definition for %s category found"), "LC_ADDRESS"));
 
   if (address->lang_ab == NULL)
     {
-      if (iso639[cnt].ab[0] != '\0' && verbose && ! nothing)
+      if ((cnt == sizeof (iso639) / sizeof (iso639[0])
+	   || iso639[cnt].ab[0] != '\0')
+	  && verbose && ! nothing)
 	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"),
 				"LC_ADDRESS", "lang_ab"));
       address->lang_ab = "";
     }
   else if (address->lang_ab[0] == '\0')
     {
-      if (iso639[cnt].ab[0] != '\0' && verbose)
+      if ((cnt == sizeof (iso639) / sizeof (iso639[0])
+	   || iso639[cnt].ab[0] != '\0')
+	  && verbose)
 	WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"),
 				"LC_ADDRESS", "lang_ab"));
     }
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index a101a402f4..a901c4d985 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -302,7 +302,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
 	    {
 	      size_t act = 0;
 	      size_t max = 10;
-	      char *grouping = ignore_content ? NULL : xmalloc (max);
+	      char *grouping = xmalloc (max);
 
 	      do
 		{
@@ -321,24 +321,20 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
 		    }
 
 		  if (now->tok == tok_minus1)
-		    {
-		      if (!ignore_content)
-			grouping[act++] = '\177';
-		    }
+		    grouping[act++] = '\177';
 		  else if (now->val.num == 0)
 		    {
 		      /* A value of 0 disables grouping from here on but
 			 we must not store a NUL character since this
 			 terminates the string.  Use something different
 			 which must not be used otherwise.  */
-		      if (!ignore_content)
-			grouping[act++] = '\377';
+		      grouping[act++] = '\377';
 		    }
 		  else if (now->val.num > 126)
 		    lr_error (ldfile, _("\
 %s: values for field `%s' must be smaller than 127"),
 			      "LC_NUMERIC", "grouping");
-		  else if (!ignore_content)
+		  else
 		    grouping[act++] = now->val.num;
 
 		  /* Next must be semicolon.  */
@@ -353,13 +349,10 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
 	      if (now->tok != tok_eol)
 		goto err_label;
 
-	      if (!ignore_content)
-		{
-		  grouping[act++] = '\0';
+	      grouping[act++] = '\0';
 
-		  numeric->grouping = xrealloc (grouping, act);
-		  numeric->grouping_len = act;
-		}
+	      numeric->grouping = xrealloc (grouping, act);
+	      numeric->grouping_len = act;
 	    }
 	  break;
 
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 1d3e60f69f..6587f7305b 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001,2002,2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
@@ -214,12 +214,6 @@ lr_token (struct linereader *lr, const struct charmap_t *charmap,
 	}
       while (isspace (ch));
 
-      if (ch == EOF)
-	{
-	  lr->token.tok = tok_eof;
-	  return &lr->token;
-	};
-
       if (ch != lr->comment_char)
 	break;
 
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index f4c29fc173..de23e123e3 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,52 @@
+2006-04-24  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #2349]
+	* locales/de_CH: Change thousand separator to '.
+
+2006-01-17  Robert Millan  <robertmh@gnu.org>
+
+	[BZ #2158]
+	* SUPPORTED: Add ca_AD, ca_FR and ca_IT variants.
+	* locales/ca_AD: New file.
+	* locales/ca_FR: New file.
+	* locales/ca_IT: New file.
+				
+2006-04-23  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #2134]
+	* locales/pa_PK: New file.
+	* SUPPORTED: Add pa_PK.UTF-8.
+
+	[BZ #1974]
+	* locales/vi_VN: Fix int_frac_digits/frac_digits, abmon, mon, d_t_fmt,
+	am_pm, and name_fmt.
+
+	[BZ #1787]
+	* locales/en_ZA: Updates.
+
+	[BZ #1786]
+	* locales/af_ZA: Updates.
+
+	[BZ #1785]
+	* locales/st_ZA: Updates and formatting changes.
+
+	[BZ #1784]
+	* locales/zu_ZA: Updates and formatting changes.
+
+	[BZ #1783]
+	* locales/xh_ZA: Updates and formatting changes.
+
+	[BZ #1782]
+	* locales/nr_ZA: New file.
+	* locales/SUPPORTED: Add nr_ZA.UTF-8.
+
+2006-04-10  Jakub Jelinek  <jakub@redhat.com>
+
+	* locales/cs_CZ (LC_TIME): Define week.
+	* locales/sk_SK (LC_TIME): Likewise.
+	* locales/pl_PL (LC_TIME): Likewise.
+	* locales/en_US (LC_TIME): Change week to 7;19971130;7.
+
 2005-12-27  Roland McGrath  <roland@redhat.com>
 
 	* tst-ctype.c (main): Add some casts.
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
index 593a775419..a1e2710280 100644
--- a/localedata/SUPPORTED
+++ b/localedata/SUPPORTED
@@ -60,9 +60,15 @@ br_FR@euro/ISO-8859-15 \
 bs_BA.UTF-8/UTF-8 \
 bs_BA/ISO-8859-2 \
 byn_ER/UTF-8 \
+ca_AD.UTF-8/UTF-8 \
+ca_AD/ISO-8859-15 \
 ca_ES.UTF-8/UTF-8 \
 ca_ES/ISO-8859-1 \
 ca_ES@euro/ISO-8859-15 \
+ca_FR.UTF-8/UTF-8 \
+ca_FR/ISO-8859-15 \
+ca_IT.UTF-8/UTF-8 \
+ca_IT/ISO-8859-15 \
 cs_CZ.UTF-8/UTF-8 \
 cs_CZ/ISO-8859-2 \
 cy_GB.UTF-8/UTF-8 \
@@ -268,6 +274,7 @@ nn_NO.UTF-8/UTF-8 \
 nn_NO/ISO-8859-1 \
 no_NO.UTF-8/UTF-8 \
 no_NO/ISO-8859-1 \
+nr_ZA/UTF-8 \
 nso_ZA/UTF-8 \
 oc_FR.UTF-8/UTF-8 \
 oc_FR/ISO-8859-1 \
@@ -275,6 +282,7 @@ om_ET/UTF-8 \
 om_KE.UTF-8/UTF-8 \
 om_KE/ISO-8859-1 \
 pa_IN/UTF-8 \
+pa_PK/UTF-8 \
 pl_PL.UTF-8/UTF-8 \
 pl_PL/ISO-8859-2 \
 pt_BR.UTF-8/UTF-8 \
diff --git a/localedata/locales/af_ZA b/localedata/locales/af_ZA
index ca1fdfb36f..81f8bfe151 100644
--- a/localedata/locales/af_ZA
+++ b/localedata/locales/af_ZA
@@ -1,7 +1,13 @@
 escape_char  /
 comment_char  %
 
+% Charset: ISO-8859-1
+
 % ChangeLog
+% 1.2.1 (2005-10-13):
+%      2005-10-12 Dwayne Bailey <dwayne@translate.org.za>
+%        - Added 'Charset: ISO-8859-1' information
+%        - Updated contact information
 % 1.2 (2004-10-28):
 %      2004-10-28 Dwayne Bailey <dwayne@translate.org.za>
 %        - Corrected country_name should be "Suid-Afrika"
@@ -27,19 +33,18 @@ comment_char  %
 %        - Add all name_* to LC_NAME
 %        - Add various comments explaining items
 
-
 LC_IDENTIFICATION
 title      "Afrikaans locale for South Africa"
 source     "Zuza Software Foundation (Translate.org.za)"
 address    "Box 28364, Sunnyside, 0132, South Africa"
 contact    "Dwayne Bailey"
 email      "dwayne@translate.org.za"
-tel        "+27 12 343 0389"
-fax        "+27 12 343 0389"
+tel        "+27 12 460 1095"
+fax        "+27 12 460 1095"
 language   "Afrikaans"
 territory  "South Africa"
-revision   "1.2"
-date       "2004-10-28"
+revision   "1.2.1"
+date       "2005-10-13"
 %
 category  "af_ZA:2000";LC_IDENTIFICATION
 category  "af_ZA:2000";LC_CTYPE
diff --git a/localedata/locales/ca_AD b/localedata/locales/ca_AD
new file mode 100644
index 0000000000..f7f68f46ba
--- /dev/null
+++ b/localedata/locales/ca_AD
@@ -0,0 +1,94 @@
+comment_char %
+escape_char  /
+%
+% Catalan Language Locale for Andorra 
+% Language: ca
+% Territory: AD
+% Option: euro
+% Revision: 1.0
+% Date: 2006-01-16
+% Application: general
+% Users: general
+% Charset: ISO-8859-15
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title      "Catalan locale for Andorra "
+source     "Robert Millan"
+address    ""
+contact    ""
+email      ""
+tel        ""
+fax        ""
+language   "Catalan"
+territory  "Andorra"
+revision   "1.0"
+date       "2006-01-16"
+%
+category  "ca_AD:2000";LC_IDENTIFICATION
+category  "ca_AD:2000";LC_CTYPE
+category  "ca_AD:2000";LC_COLLATE
+category  "ca_AD:2000";LC_TIME
+category  "ca_AD:2000";LC_NUMERIC
+category  "ca_AD:2000";LC_MONETARY
+category  "ca_AD:2000";LC_MESSAGES
+category  "ca_AD:2000";LC_PAPER
+category  "ca_AD:2000";LC_NAME
+category  "ca_AD:2000";LC_ADDRESS
+category  "ca_AD:2000";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_COLLATE
+copy "ca_ES"
+END LC_COLLATE
+
+LC_CTYPE
+copy "i18n"
+END LC_CTYPE
+
+LC_MESSAGES
+copy "ca_ES"
+END LC_MESSAGES
+
+LC_MONETARY
+copy "ca_ES"
+END LC_MONETARY
+
+LC_NUMERIC
+copy "ca_ES"
+END LC_NUMERIC
+
+LC_TIME
+copy "ca_ES"
+END LC_TIME
+
+LC_PAPER
+copy "ca_ES"
+END LC_PAPER
+
+LC_TELEPHONE
+tel_int_fmt    "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
+<U006C>"
+int_prefix     "<U0033><U0037><U0036>"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+copy "ca_ES"
+END LC_MEASUREMENT
+
+LC_NAME
+copy "ca_ES"
+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 "<U0041><U0044>"
+country_ab3 "<U0041><U004E><U0044>"
+country_num 20
+END LC_ADDRESS
diff --git a/localedata/locales/ca_FR b/localedata/locales/ca_FR
new file mode 100644
index 0000000000..38fc26af4d
--- /dev/null
+++ b/localedata/locales/ca_FR
@@ -0,0 +1,85 @@
+comment_char %
+escape_char  /
+%
+% Catalan Language Locale for France 
+% Language: ca
+% Territory: FR
+% Option: euro
+% Revision: 1.0
+% Date: 2006-01-16
+% Application: general
+% Users: general
+% Charset: ISO-8859-15
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title      "Catalan locale for France "
+source     "Robert Millan"
+address    ""
+contact    ""
+email      ""
+tel        ""
+fax        ""
+language   "Catalan"
+territory  "France"
+revision   "1.0"
+date       "2006-01-16"
+%
+category  "ca_FR:2000";LC_IDENTIFICATION
+category  "ca_FR:2000";LC_CTYPE
+category  "ca_FR:2000";LC_COLLATE
+category  "ca_FR:2000";LC_TIME
+category  "ca_FR:2000";LC_NUMERIC
+category  "ca_FR:2000";LC_MONETARY
+category  "ca_FR:2000";LC_MESSAGES
+category  "ca_FR:2000";LC_PAPER
+category  "ca_FR:2000";LC_NAME
+category  "ca_FR:2000";LC_ADDRESS
+category  "ca_FR:2000";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_COLLATE
+copy "ca_ES"
+END LC_COLLATE
+
+LC_CTYPE
+copy "i18n"
+END LC_CTYPE
+
+LC_MESSAGES
+copy "ca_ES"
+END LC_MESSAGES
+
+LC_MONETARY
+copy "ca_ES"
+END LC_MONETARY
+
+LC_NUMERIC
+copy "ca_ES"
+END LC_NUMERIC
+
+LC_TIME
+copy "ca_ES"
+END LC_TIME
+
+LC_PAPER
+copy "fr_FR"
+END LC_PAPER
+
+LC_TELEPHONE
+copy "fr_FR"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+copy "fr_FR"
+END LC_MEASUREMENT
+
+LC_NAME
+copy "ca_ES"
+END LC_NAME
+
+LC_ADDRESS
+copy "fr_FR"
+END LC_ADDRESS
diff --git a/localedata/locales/ca_IT b/localedata/locales/ca_IT
new file mode 100644
index 0000000000..8f37a45554
--- /dev/null
+++ b/localedata/locales/ca_IT
@@ -0,0 +1,85 @@
+comment_char %
+escape_char  /
+%
+% Catalan Language Locale for Italy (L'Alguer) 
+% Language: ca
+% Territory: IT
+% Option: euro
+% Revision: 1.0
+% Date: 2006-01-16
+% Application: general
+% Users: general
+% Charset: ISO-8859-15
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title      "Catalan locale for Italy (L'Alguer) "
+source     "Robert Millan"
+address    ""
+contact    ""
+email      ""
+tel        ""
+fax        ""
+language   "Catalan"
+territory  "Italy (L'Alguer)"
+revision   "1.0"
+date       "2006-01-16"
+%
+category  "ca_IT:2000";LC_IDENTIFICATION
+category  "ca_IT:2000";LC_CTYPE
+category  "ca_IT:2000";LC_COLLATE
+category  "ca_IT:2000";LC_TIME
+category  "ca_IT:2000";LC_NUMERIC
+category  "ca_IT:2000";LC_MONETARY
+category  "ca_IT:2000";LC_MESSAGES
+category  "ca_IT:2000";LC_PAPER
+category  "ca_IT:2000";LC_NAME
+category  "ca_IT:2000";LC_ADDRESS
+category  "ca_IT:2000";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_COLLATE
+copy "ca_ES"
+END LC_COLLATE
+
+LC_CTYPE
+copy "i18n"
+END LC_CTYPE
+
+LC_MESSAGES
+copy "ca_ES"
+END LC_MESSAGES
+
+LC_MONETARY
+copy "ca_ES"
+END LC_MONETARY
+
+LC_NUMERIC
+copy "ca_ES"
+END LC_NUMERIC
+
+LC_TIME
+copy "ca_ES"
+END LC_TIME
+
+LC_PAPER
+copy "it_IT"
+END LC_PAPER
+
+LC_TELEPHONE
+copy "it_IT"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+copy "it_IT"
+END LC_MEASUREMENT
+
+LC_NAME
+copy "ca_ES"
+END LC_NAME
+
+LC_ADDRESS
+copy "it_IT"
+END LC_ADDRESS
diff --git a/localedata/locales/cs_CZ b/localedata/locales/cs_CZ
index 720842d96f..a4f297e4b3 100644
--- a/localedata/locales/cs_CZ
+++ b/localedata/locales/cs_CZ
@@ -2434,7 +2434,7 @@ abmon		"<U006C><U0065><U0064>";/
 %		"<U004E><U006F><U0076>";/
 %		"<U0044><U0065><U0063>"
 
-%week		???
+week		7;19971201;4
 
 d_t_fmt		"<U0025><U0061><U00A0><U0025><U0065><U002E><U00A0><U0025><U0042><U00A0><U0025><U0059><U002C><U00A0><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U00A0><U0025><U005A>"
 
diff --git a/localedata/locales/de_CH b/localedata/locales/de_CH
index 96d44b5ee4..84963b56fd 100644
--- a/localedata/locales/de_CH
+++ b/localedata/locales/de_CH
@@ -62,7 +62,7 @@ LC_MONETARY
 int_curr_symbol           "<U0043><U0048><U0046><U0020>"
 currency_symbol           "<U0046><U0072><U002E>"
 mon_decimal_point         "<U002E>"
-mon_thousands_sep         "<U0020>"
+mon_thousands_sep         "<U0027>"
 mon_grouping              3;3
 positive_sign             ""
 negative_sign             "<U002D>"
@@ -78,7 +78,7 @@ END LC_MONETARY
 
 LC_NUMERIC
 decimal_point             "<U002E>"
-thousands_sep             "<U0020>"
+thousands_sep             "<U0027>"
 grouping                  3;3
 END LC_NUMERIC
 
diff --git a/localedata/locales/en_US b/localedata/locales/en_US
index b2ad72d5ce..5500484285 100644
--- a/localedata/locales/en_US
+++ b/localedata/locales/en_US
@@ -81,7 +81,7 @@ day	"<U0053><U0075><U006E><U0064><U0061><U0079>";/
 	"<U0046><U0072><U0069><U0064><U0061><U0079>";/
 	"<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
 
-week    7;19971201;4
+week    7;19971130;7
 abmon	"<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
 	"<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
 	"<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
diff --git a/localedata/locales/en_ZA b/localedata/locales/en_ZA
index 6e0c232bc2..51da395c02 100644
--- a/localedata/locales/en_ZA
+++ b/localedata/locales/en_ZA
@@ -8,8 +8,8 @@ comment_char  %
 % Fax: +27 12 3430389
 % Language: en
 % Territory: ZA
-% Revision: 1.2
-% Date: 2003-10-27
+% Revision: 1.2.1
+% Date: 2005-10-13
 % Users: general
 % Repertoiremap: mnemonic,ds
 % Charset: ISO-8859-1
@@ -17,6 +17,9 @@ comment_char  %
 % for commercial purposes.
 %
 % Changelog
+% 1.2.1 (2005-10-13):
+%     2005-10-12 Dwayne Bailey <dwayne@translate.org.za>
+%       - Update contact information
 % 1.2 (2004-10-27):
 %     2004-10-27 Dwayne Bailey <dwayne@translate.org.za>
 %       - Remove .* from LC_MESSAGES yes/noexpr
@@ -45,15 +48,15 @@ source     "Zuza Software Foundation (Translate.org.za)"
 address    "Box 28364, Sunnyside, 0132, South Africa"
 contact    "Dwayne Bailey"
 email      "dwayne@translate.org.za"
-tel        "+27 12 343 0389"
-fax        "+27 12 343 0389"
+tel        "+27 12 460 1095"
+fax        "+27 12 460 1095"
 language   "English"
 territory  "South Africa"
 % audience     ""
 % application  ""
 abbreviation "Translate.org.za"
-revision   "1.2"
-date       "2003-10-27"
+revision   "1.2.1"
+date       "2005-10-13"
 %
 category  "en_ZA:2003";LC_IDENTIFICATION
 category  "en_ZA:2000";LC_CTYPE
diff --git a/localedata/locales/nr_ZA b/localedata/locales/nr_ZA
new file mode 100644
index 0000000000..916a3fa3a0
--- /dev/null
+++ b/localedata/locales/nr_ZA
@@ -0,0 +1,281 @@
+escape_char  /
+comment_char  %
+
+% Charset: UTF-8
+
+% ChangeLog
+% 0.3 (2005-10-13):
+%     2005-10-12 Dwayne Bailey <dwayne@translate.org.za>
+%       - Added 'Charset: UTF-8' information
+%       - Update contact information
+%       - Allign spellings of month and weekday names with Dept. of
+%         Art and Culture's: Multilingual Mathematics Dictionary
+% 0.2 (2004-11-09):
+%     2004-11-09 Dwayne Bailey <dwayne@translate.org.za>
+%       - <UNNNN> escape everything
+%       - Update all contact information
+%       - Change %d to %-e for d_t_fmt and date_fmt
+%       - Reset yes/noexpr to English
+%       - set all abmon, mon, abday, day to English until correct defintions
+%         are available.
+%     2004-03-30 Dwayne Bailey <dwayne@translate.org.za>
+%       - Added country_ab2/3, country_num
+%     2004-02-27 Dwayne Bailey <dwayne@translate.org.za>
+%	    - Correct capatilisation of lang_name
+% 0.1 (2004-02-24):
+%       - Initial Southern Ndebele locale for South Africa
+%         by Zuza Software Foundation
+
+LC_IDENTIFICATION
+title      "Southern Ndebele locale for South Africa"
+source     "Zuza Software Foundation (Translate.org.za)"
+address    "PO Box 28364, Sunnyside, 0132, South Africa"
+contact    "Dwayne Bailey"
+email      "dwayne@translate.org.za"
+tel        "+27 12 460 1095"
+fax        "+27 12 460 1095"
+language   "Southern Ndebele"
+territory  "South Africa"
+revision   "0.3"
+date       "2005-10-13"
+%
+category  "nr_ZA:2004";LC_IDENTIFICATION
+category  "nr_ZA:2004";LC_CTYPE
+category  "nr_ZA:2004";LC_COLLATE
+category  "nr_ZA:2004";LC_TIME
+category  "nr_ZA:2004";LC_NUMERIC
+category  "nr_ZA:2004";LC_MONETARY
+category  "nr_ZA:2004";LC_MESSAGES
+category  "nr_ZA:2004";LC_PAPER
+category  "nr_ZA:2004";LC_NAME
+category  "nr_ZA:2004";LC_ADDRESS
+category  "nr_ZA:2004";LC_TELEPHONE
+category  "nr_ZA:2004";LC_MEASUREMENT
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+% Use the characters described in the charmap file "i18n.tgz"
+copy "i18n"
+END LC_CTYPE
+
+LC_COLLATE
+% Copy the template from ISO/IEC 14651 i.e.
+% use the rules there when making ordered lists of words.
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_MONETARY
+copy "en_ZA"
+END LC_MONETARY
+
+LC_NUMERIC
+copy "en_ZA"
+END LC_NUMERIC
+
+LC_TIME
+
+% abday - The abbreviations for the week days:
+% - Son, Mvu, Bil, Tha, Ne, Hla, Gqi
+abday       "<U0053><U006F><U006E>";"<U004D><U0076><U0075>";/
+            "<U0042><U0069><U006C>";"<U0054><U0068><U0061>";/
+            "<U004E><U0065>";"<U0048><U006C><U0061>";/
+            "<U0047><U0071><U0069>"
+ 
+% day - The full names of the week days:
+% - uSonto, uMvulo, uLesibili, lesithathu, uLesine, ngoLesihlanu, umGqibelo
+day         "<U0075><U0053><U006F><U006E><U0074><U006F>";/
+            "<U0075><U004D><U0076><U0075><U006C><U006F>";/
+            "<U0075><U004C><U0065><U0073><U0069><U0062><U0069><U006C><U0069>";/
+            "<U006C><U0065><U0073><U0069><U0074><U0068><U0061><U0074><U0068><U0075>";/
+            "<U0075><U004C><U0065><U0073><U0069><U006E><U0065>";/
+            "<U006E><U0067><U006F><U004C><U0065><U0073><U0069><U0068><U006C><U0061><U006E><U0075>";/
+            "<U0075><U006D><U0047><U0071><U0069><U0062><U0065><U006C><U006F>"
+ 
+% abmon - The abbreviations for the months 
+% - Jan, Feb, Mat, Apr, Mey, Jun, Jul, Arh, Sep, Okt, Usi, Dis
+abmon       "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
+            "<U004D><U0061><U0074>";"<U0041><U0070><U0072>";/
+            "<U004D><U0065><U0079>";"<U004A><U0075><U006E>";/
+            "<U004A><U0075><U006C>";"<U0041><U0072><U0068>";/
+            "<U0053><U0065><U0070>";"<U004F><U006B><U0074>";/
+            "<U0055><U0073><U0069>";"<U0044><U0069><U0073>"
+ 
+% mon - The full names of the months - 
+% - Janabari, uFeberbari, uMatjhi, u-Apreli, Meyi, Juni
+%   Julayi, Arhostosi, Septemba, Oktoba, Usinyikhaba, Disemba
+mon         "<U004A><U0061><U006E><U0061><U0062><U0061><U0072><U0069>";/
+            "<U0075><U0046><U0065><U0062><U0065><U0072><U0062><U0061><U0072><U0069>";/
+            "<U0075><U004D><U0061><U0074><U006A><U0068><U0069>";/
+            "<U0075><U002D><U0041><U0070><U0072><U0065><U006C><U0069>";/
+            "<U004D><U0065><U0079><U0069>";/
+            "<U004A><U0075><U006E><U0069>";/
+            "<U004A><U0075><U006C><U0061><U0079><U0069>";/
+            "<U0041><U0072><U0068><U006F><U0073><U0074><U006F><U0073><U0069>";/
+            "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0061>";/
+            "<U004F><U006B><U0074><U006F><U0062><U0061>";/
+            "<U0055><U0073><U0069><U006E><U0079><U0069><U006B><U0068><U0061><U0062><U0061>";/
+            "<U0044><U0069><U0073><U0065><U006D><U0062><U0061>"
+
+% Abreviated date and time representation to be referenced by the "%c" field descriptor -
+d_t_fmt     "<U0025><U0061><U0020><U0025><U002D><U0065><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+%
+% "%a" (short weekday name),
+% "%-e" (day of month as a decimal number),
+% "%b" (short month name),
+% "%Y" (year with century as a decimal number),
+% "%T" (24-hour clock time in format HH:MM:SS),
+% "%Z" (Time zone name)
+ 
+% Date representation to be referenced by the "%x" field descriptor -
+d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
+% "%d/%m/%Y", day/month/year as decimal numbers (01/01/2000).
+ 
+% Time representation to be referenced by the "%X" field descriptor -
+t_fmt       "<U0025><U0054>"
+% "%T" (24-hour clock time in format HH:MM:SS)
+ 
+% Define representation of ante meridiem and post meridiem strings -
+am_pm       "";""
+% The "" mean 'default to "AM" and "PM".
+ 
+% Define time representation in 12-hour format with "am_pm", to be referenced by the "%r"
+t_fmt_ampm  ""
+% The "" means that this format is not supported.
+ 
+% Date representation not described in ISO/IEC 14652. Comes out as -
+% "%a %b %-e %H:%M:%S %Z %Y" which is default "date" command output
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U002D><U0065>/
+<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
+<U0025><U005A><U0020><U0025><U0059>"
+%
+% %a - abbreviated weekday name,
+% %b - abreviated month name,
+% %-e - day of month as a decimal number with leading space (1 to 31),
+% %H - hour (24-hour clock) as a decimal number (00 to 23),
+% %M - minute as a decimal number (00 to 59),
+% %S - seconds as a decimal number (00 to 59),
+% %Z - time-zone name,
+% %Y - year with century as a decimal number,e.g. 2001.
+ 
+END LC_TIME
+
+LC_MESSAGES
+% FIXME: Check both of these
+% The affirmative response - TODO
+% "^[yY]"
+yesexpr     "<U005E><U005B><U0079><U0059><U005D>"
+
+% The negative response - TODO
+% "^[nN]"
+noexpr      "<U005E><U005B><U006E><U004E><U005D>"
+END LC_MESSAGES
+
+LC_PAPER
+copy "en_ZA"
+END LC_PAPER
+
+LC_TELEPHONE
+copy "en_ZA"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+copy "en_ZA"
+END LC_MEASUREMENT
+
+LC_NAME
+% Format for addressing a person.
+name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+% "%d%t%g%t%m%t%f"
+% "Salutation",
+% "Empty string, or <Space>",
+% "First given name",
+% "Empty string, or <Space>",
+% "Middle names",
+% "Empty string, or <Space>",
+% "Clan names"
+ 
+% FIXME - define all the following name_*
+% General salutation for any sex
+% name_gen    ""
+
+% Salutation for unmarried females - ""
+% name_miss   ""
+ 
+% Salutation for males - ""
+% name_mr     ""
+
+% Salutation for married females - ""
+% name_mrs    ""
+
+% Salutation valid for all females - "" (no term)
+% name_ms     ""
+
+END LC_NAME
+
+LC_ADDRESS
+% Country name in Southern Ndebele - "iSewula Afrika"
+country_name "<U0069><U0053><U0065><U0077><U0075><U006C><U0061><U0020><U0041><U0066><U0072><U0069><U006B><U0061>"
+ 
+% Abbreviated country postal name - "ZA"
+country_post "<U005A><U0041>"
+ 
+% UN Geneve 1949:68 Distinguishing signs of vehicles in international traffic
+% http://www.unece.org/trans/conventn/disting-signs-5-2001.pdf
+% "ZA"
+country_car   "<U005A><U0041>"
+
+% FIXME define the following correctly
+% country_isbn ""
+% country_num 
+ 
+% Language name in Southern Ndebele - "IsiNdebele"
+lang_name "<U0049><U0073><U0069><U004E><U0064><U0065><U0062><U0065><U006C><U0065>"
+
+% ISO 639 two and three letter language names
+% see http://www.loc.gov/standards/iso639-2/englangn.html
+% "nr", "nbl"
+lang_ab   "<U006E><U0072>"
+lang_term "<U006E><U0062><U006C>"
+ 
+% Representation of postal addresses (minus the addressee's name) in South
+% Africa. (Ignored for now)
+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>"
+% "%f%N%a%N%d%N%b%N%s %h %e %r%N%%z %T%N%c%N", which gives -
+% "firm name",
+% "end of line",
+% "C/O address",
+% "end of line",
+% "department name",
+% "Building name",
+% "end of line",
+% "street or block name",
+% "space",
+% "house number or designation",
+% "space",
+% "floor number",
+% "space",
+% "room number, door designation",
+% "end of line",
+% "postal code",
+% "space",
+% "town, city",
+% "end of line",
+% "country designation for the <country_post> keyword",
+% "end of line
+%
+
+% ISO 3166 country number and 2 and 3 letter abreviations
+% http://www.unicode.org/onlinedat/countries.html
+% "ZA", "ZAF"
+country_num   710
+country_ab2   "<U005A><U0041>"
+country_ab3   "<U005A><U0041><U0046>"
+
+END LC_ADDRESS
+
diff --git a/localedata/locales/pa_PK b/localedata/locales/pa_PK
new file mode 100644
index 0000000000..fcc78a0c5a
--- /dev/null
+++ b/localedata/locales/pa_PK
@@ -0,0 +1,187 @@
+comment_char %
+escape_char  /
+%
+% Punjabi (Shamukhi) Language Locale for Pakistan
+% Source:
+% Contact: Amanpreet Singh Alam
+% Email: amanpreetalam@yahoo.com
+% Language: pa
+% Territory: PK
+% Revision: 0.1
+% Date: 2005-12-31
+% Users: general
+% Charset: UTF-8
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title      "Punjabi (Shahmukhi) Language Locale for Pakistan"
+source     ""
+address    ""
+contact    ""
+email      "bug-glibc-locales@gnu.org"
+tel        ""
+fax        ""
+language   "Punjabi (Shahmukhi)"
+territory  "Pakistan"
+revision   "0.3"
+date       "2000-07-11"
+%
+category  "pa_PK:2000";LC_IDENTIFICATION
+category  "pa_PK:2000";LC_CTYPE
+category  "pa_PK:2000";LC_COLLATE
+category  "pa_PK:2000";LC_TIME
+category  "pa_PK:2000";LC_NUMERIC
+category  "pa_PK:2000";LC_MONETARY
+category  "pa_PK:2000";LC_MESSAGES
+category  "pa_PK:2000";LC_PAPER
+category  "pa_PK:2000";LC_NAME
+category  "pa_PK:2000";LC_ADDRESS
+category  "pa_PK:2000";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+translit_start
+include "translit_combining";""
+
+% those two lettes are not in cp1256...
+
+% Maddah above -> Alef with madda above
+<U0653> "<U0622>"
+% Farsi yeh -> yeh
+<U06CC> "<U064A>"
+
+translit_end
+END LC_CTYPE
+
+LC_COLLATE
+copy "en_DK"
+END LC_COLLATE
+
+LC_MONETARY
+copy "ur_PK"
+END LC_MONETARY
+
+LC_NUMERIC
+copy "ur_PK"
+END LC_NUMERIC
+
+% Since their is no abbreviated version of the days in urdu I have used the
+% full names of the days
+% Using only the first letters of the day would have caused a conflict here
+% as both "Jumairat(Thurs)" and "Juma(Friday)" have the same starting letter
+% Jeem <U062C>
+LC_TIME
+
+abday   "<U0627><U062A><U0648><U0627><U0631>";/
+	"<U067E><U064A><U0631>";/
+	"<U0645><U0646><U06AF><U0644>";/
+	"<U0628><U062F><U06BE>";/
+	"<U062C><U0645><U0639><U0631><U0627><U062A>";/
+	"<U062C><U0645><U0639><U0647>";/
+	"<U0647><U0641><U062A><U0647>"
+day	"<U0627><U062A><U0648><U0627><U0631>";/
+	"<U067E><U064A><U0631>";/
+	"<U0645><U0646><U06AF><U0644>";/
+	"<U0628><U062F><U06BE>";/
+	"<U062C><U0645><U0639><U0631><U0627><U062A>";/
+	"<U062C><U0645><U0639><U0647>";/
+	"<U0647><U0641><U062A><U0647>"
+abmon	"<U062C><U0646><U0648><U0631><U064A>";/
+	"<U0641><U0631><U0648><U0631><U064A>";/
+	"<U0645><U0627><U0631><U0686>";/
+	"<U0627><U067E><U0631><U064A><U0644>";/
+	"<U0645><U0653><U06CC>";/
+	"<U062C><U0648><U0646>";/
+	"<U062C><U0648><U0644><U0627><U064A>";/
+	"<U0627><U06AF><U0633><U062A>";/
+	"<U0633><U062A><U0645><U0628><U0631>";/
+	"<U0627><U0643><U062A><U0648><U0628><U0631>";/
+	"<U0646><U0648><U0645><U0628><U0631>";/
+	"<U062F><U0633><U0645><U0628><U0631>"
+mon	"<U062C><U0646><U0648><U0631><U064A>";/
+	"<U0641><U0631><U0648><U0631><U064A>";/
+	"<U0645><U0627><U0631><U0686>";/
+	"<U0627><U067E><U0631><U064A><U0644>";/
+	"<U0645><U0653><U06CC>";/
+	"<U062C><U0648><U0646>";/
+	"<U062C><U0648><U0644><U0627><U064A>";/
+	"<U0627><U06AF><U0633><U062A>";/
+	"<U0633><U062A><U0645><U0628><U0631>";/
+	"<U0627><U0643><U062A><U0648><U0628><U0631>";/
+	"<U0646><U0648><U0645><U0628><U0631>";/
+	"<U062F><U0633><U0645><U0628><U0631>"
+
+% Date Time Format
+d_t_fmt "<U0648><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U0020><U062A><U0020><U0025><U0064><U0020><U0025><U0042><U0020><U0025><U0059>"
+
+% date Format. I have put this in reverse order to try to get the date
+% in R->L order
+d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
+
+% time format
+t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
+
+%<U0635> stands for <U0635><U0628><U062D>
+%<U0634> stands for <U0634><U0627><U0645>
+am_pm "<U0635>";"<U0634>"
+
+%time format in 12 hour clock
+t_fmt_ampm "<U0025><U0050><U0020><U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>"
+
+% display columns right to left ?
+cal_direction	3
+END LC_TIME
+
+LC_MESSAGES
+
+% locale based messages
+% Can we put in the values for a cancel exression here?? I found a term that
+% would define cancel appropriately
+% <U0647> = <U0647><U0627><U06BA> , the last tag is for noon-ghunna!
+% <U0628> = <U0628><U0644><U0643><U0644>
+% again <U0066> and <U006F> are place holders
+% <U0646> = <U0646><U0647><U064A><U06BA>
+yesstr	"<U0628><U0644><U0643><U0644>"
+nostr	"<U0646><U0647><U064A><U06BA>"
+yesexpr	"<U005E><U005B><U0079><U0059><U0647><U0628><U0066><U005D><U002E><U002A>"
+noexpr	"<U005E><U005B><U006E><U004E><U0646><U006F><U005D><U002E><U002A>"
+
+END LC_MESSAGES
+
+%Draft Finished: 17:00 09/07/2000
+
+LC_PAPER
+copy "ur_PK"
+END LC_PAPER
+
+LC_MEASUREMENT
+copy "ur_PK"
+END LC_MEASUREMENT
+
+LC_NAME
+% FIXME
+copy "ur_PK"
+END LC_NAME
+
+LC_ADDRESS
+% FIXME
+postal_fmt    "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0068>/
+<U0020><U0025><U0073><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0025><U0054><U0020><U0025><U007A><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+
+country_ab2 "<U0050><U004B>"
+country_ab3 "<U0050><U0041><U004B>"
+country_num 586
+END LC_ADDRESS
+
+LC_TELEPHONE
+% Changed from ur_PK as that Locale just copy from en_DK, which is not suitable to Punjabi (Shahmukhi) ISD 92
+tel_int_fmt "<U002B><U0025><U0063><U0020><U003B><U0025><U0061><U0020><U003B><U0025><U006C>"
+int_prefix "<U0039><U0032>"
+int_select "<U0030><U0030>"
+END LC_TELEPHONE
diff --git a/localedata/locales/pl_PL b/localedata/locales/pl_PL
index 0c820683c8..8c0d470ecf 100644
--- a/localedata/locales/pl_PL
+++ b/localedata/locales/pl_PL
@@ -2183,6 +2183,7 @@ t_fmt_ampm ""
 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>"
+week	7;19971201;4
 END LC_TIME
 
 LC_PAPER
diff --git a/localedata/locales/sk_SK b/localedata/locales/sk_SK
index 8b53b0c62f..28863fa935 100644
--- a/localedata/locales/sk_SK
+++ b/localedata/locales/sk_SK
@@ -179,6 +179,8 @@ 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>"
 
+week		7;19971201;4
+
 END LC_TIME
 
 %% END OF LOCALIZATION FILE for sk_SK.ISO-8859-2
diff --git a/localedata/locales/st_ZA b/localedata/locales/st_ZA
index 798de4cf66..d36eb9ab2c 100644
--- a/localedata/locales/st_ZA
+++ b/localedata/locales/st_ZA
@@ -1,7 +1,15 @@
 escape_char  /
 comment_char  %
 
+% Charset: UTF-8
+
 % ChangeLog
+% 0.3 (2005-10-13):
+%    2005-10-12 Dwayne Bailey <dwayne@translate.org.za>
+%      - Added 'Charset: UTF-8' information
+%      - Update contact information
+%      - Allign spellings of month and weekday names with Dept. of
+%        Art and Culture's: Multilingual Mathematics Dictionary
 % 0.2 (2004-11-03):
 %    2004-11-02 Dwayne Bailey <dwayne@translate.org.za>
 %      - Change all contact information
@@ -22,12 +30,12 @@ source     "Zuza Software Foundation (Translate.org.za)"
 address    "PO Box 28364, Sunnyside, 0132, South Africa"
 contact    "Dwayne Bailey"
 email      "dwayne@translate.org.za"
-tel        "+27 12 343 0389"
-fax        "+27 12 343 0389"
+tel        "+27 12 460 1095"
+fax        "+27 12 460 1095"
 language   "Sotho"
 territory  "South Africa"
-revision   "0.2"
-date       "2004-11-03"
+revision   "0.3"
+date       "2005-10-13"
 %
 category  "st_ZA:2003";LC_IDENTIFICATION
 category  "st_ZA:2003";LC_CTYPE
@@ -76,38 +84,38 @@ abday       "<U0053><U006F><U006E>";/
             "<U004D><U006F><U0071>"
  
 % day - The full names of the week days:
-% - Sontaha, Mmantaha, Labobedi, Laboraru, Labone, Labohlane, Moqebelo
+% - Sontaha, Mantaha, Labobedi, Laboraro, Labone, Labohlano, Moqebelo
 day         "<U0053><U006F><U006E><U0074><U0061><U0068><U0061>";/
-            "<U004D><U006D><U0061><U006E><U0074><U0061><U0068><U0061>";/
+            "<U004D><U0061><U006E><U0074><U0061><U0068><U0061>";/
             "<U004C><U0061><U0062><U006F><U0062><U0065><U0064><U0069>";/
-            "<U004C><U0061><U0062><U006F><U0072><U0061><U0072><U0075>";/
+            "<U004C><U0061><U0062><U006F><U0072><U0061><U0072><U006F>";/
             "<U004C><U0061><U0062><U006F><U006E><U0065>";/
-            "<U004C><U0061><U0062><U006F><U0068><U006C><U0061><U006E><U0065>";/
+            "<U004C><U0061><U0062><U006F><U0068><U006C><U0061><U006E><U006F>";/
             "<U004D><U006F><U0071><U0065><U0062><U0065><U006C><U006F>"
  
 % abmon - The abbreviations for the months 
-% - Phe, Kol, Ube, Mme, Mot, Jan, Upu, Pha, Leo, Mph, Pun, Tsh
-abmon       "<U0050><U0068><U0065>";"<U004B><U006F><U006C>";/
-            "<U0055><U0062><U0065>";"<U004D><U006D><U0065>";/
+% - Phe, Hla, Tlh, Mme, Mot, Jan, Upu, Pha, Leo, Mph, Pud, Tsh
+abmon       "<U0050><U0068><U0065>";"<U0048><U006C><U0061>";/
+            "<U0054><U006C><U0048>";"<U004D><U006D><U0065>";/
             "<U004D><U006F><U0074>";"<U004A><U0061><U006E>";/
             "<U0055><U0070><U0075>";"<U0050><U0068><U0061>";/
             "<U004C><U0065><U006F>";"<U004D><U0070><U0068>";/
-            "<U0050><U0075><U006E>";"<U0054><U0073><U0068>"
+            "<U0050><U0075><U0064>";"<U0054><U0073><U0068>"
  
 % mon - The full names of the months - 
-% - Phesekgong, Hlakola, Hlakubele, Mmese, Motsheanong, Phupjane, 
-%   Phupu, Phata, Leotshe, Mphalane, Pundungwane, Tshitwe
-mon         "<U0050><U0068><U0065><U0073><U0065><U006B><U0067><U006F><U006E><U0067>";/
+% - Pherekgong, Hlakola, Tlhakubele, Mmese, Motsheanong, Phupjane, 
+%   Phupu, Phato, Leotse, Mphalane, Pudungwana, Tshitwe
+mon         "<U0050><U0068><U0065><U0072><U0065><U006B><U0067><U006F><U006E><U0067>";/
             "<U0048><U006C><U0061><U006B><U006F><U006C><U0061>";/
-            "<U0048><U006C><U0061><U006B><U0075><U0062><U0065><U006C><U0065>";/
+            "<U0054><U006C><U0068><U0061><U006B><U0075><U0062><U0065><U006C><U0065>";/
             "<U004D><U006D><U0065><U0073><U0065>";/
             "<U004D><U006F><U0074><U0073><U0068><U0065><U0061><U006E><U006F><U006E><U0067>";/
             "<U0050><U0068><U0075><U0070><U006A><U0061><U006E><U0065>";/
             "<U0050><U0068><U0075><U0070><U0075>";/
-            "<U0050><U0068><U0061><U0074><U0061>";/
-            "<U004C><U0065><U006F><U0074><U0073><U0068><U0065>";/
+            "<U0050><U0068><U0061><U0074><U006F>";/
+            "<U004C><U0065><U006F><U0074><U0073><U0065>";/
             "<U004D><U0070><U0068><U0061><U006C><U0061><U006E><U0065>";/
-            "<U0050><U0075><U006E><U0064><U0075><U006E><U0067><U0077><U0061><U006E><U0065>";/
+            "<U0050><U0075><U0064><U0075><U006E><U0067><U0077><U0061><U006E><U0061>";/
             "<U0054><U0073><U0068><U0069><U0074><U0077><U0065>"
  
 % Abreviated date and time representation to be referenced by the "%c" field descriptor -
diff --git a/localedata/locales/vi_VN b/localedata/locales/vi_VN
index 969d4ef766..29be5dcd5e 100644
--- a/localedata/locales/vi_VN
+++ b/localedata/locales/vi_VN
@@ -233,8 +233,8 @@ mon_thousands_sep     "<U002E>"
 mon_grouping          3;3
 positive_sign         ""
 negative_sign         "<U002D>"
-int_frac_digits       4
-frac_digits           4
+int_frac_digits       0
+frac_digits           0
 p_cs_precedes         0
 p_sep_by_space        0
 n_cs_precedes         1
@@ -264,19 +264,19 @@ day      "<U0043><U0068><U1EE7><U0020><U006E><U0068><U1EAD><U0074>";/
          "<U0054><U0068><U1EE9><U0020><U006E><U0103><U006D>";/
          "<U0054><U0068><U1EE9><U0020><U0073><U00E1><U0075>";/
          "<U0054><U0068><U1EE9><U0020><U0062><U1EA3><U0079>"
-abmon    "<U0054><U0068><U0031>";/
-         "<U0054><U0068><U0032>";/
-         "<U0054><U0068><U0033>";/
-         "<U0054><U0068><U0034>";/
-         "<U0054><U0068><U0035>";/
-         "<U0054><U0068><U0036>";/
-         "<U0054><U0068><U0037>";/
-         "<U0054><U0068><U0038>";/
-         "<U0054><U0068><U0039>";/
+abmon    "<U0054><U0068><U0030><U0031>";/
+         "<U0054><U0068><U0030><U0032>";/
+         "<U0054><U0068><U0030><U0033>";/
+         "<U0054><U0068><U0030><U0034>";/
+         "<U0054><U0068><U0030><U0035>";/
+         "<U0054><U0068><U0030><U0036>";/
+         "<U0054><U0068><U0030><U0037>";/
+         "<U0054><U0068><U0030><U0038>";/
+         "<U0054><U0068><U0030><U0039>";/
          "<U0054><U0068><U0031><U0030>";/
          "<U0054><U0068><U0031><U0031>";/
          "<U0054><U0068><U0031><U0032>"
-mon      "<U0054><U0068><U00E1><U006E><U0067><U0020><U0067><U0069><U00EA><U006E><U0067>";/
+mon      "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U1ED9><U0074>";/
          "<U0054><U0068><U00E1><U006E><U0067><U0020><U0068><U0061><U0069>";/
          "<U0054><U0068><U00E1><U006E><U0067><U0020><U0062><U0061>";/
          "<U0054><U0068><U00E1><U006E><U0067><U0020><U0074><U01B0>";/
@@ -286,12 +286,12 @@ mon      "<U0054><U0068><U00E1><U006E><U0067><U0020><U0067><U0069><U00EA><U006E>
          "<U0054><U0068><U00E1><U006E><U0067><U0020><U0074><U00E1><U006D>";/
          "<U0054><U0068><U00E1><U006E><U0067><U0020><U0063><U0068><U00ED><U006E>";/
          "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U01B0><U1EDD><U0069>";/
-         "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U1ED9><U0074>";/
-         "<U0054><U0068><U00E1><U006E><U0067><U0020><U0063><U0068><U1EA1><U0070>"
-d_t_fmt  "<U0025><U0041><U002C><U0020><U0025><U0064><U0020><U0025><U0042><U0020><U006E><U0103><U006D><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
+         "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U01B0><U1EDD><U0069><U0020><U006D><U1ED9><U0074>";/
+         "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U01B0><U1EDD><U0069><U0020><U0068><U0061><U0069>"
+d_t_fmt  "<U0025><U0041><U002C><U0020><U0025><U0064><U0020><U0025><U0042><U0020><U004E><U0103><U006D><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
 d_fmt    "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
 t_fmt    "<U0025><U0054>"
-am_pm    "<U0073><U00E1><U006E><U0067>";"<U0063><U0068><U0069><U1EC1><U0075>"
+am_pm    "<U0041><U004D>";"<U0050><U004D>"
 t_fmt_ampm  "<U0025><U0049><U003A><U0025><U004D><U0020><U0025><U0070>"
 date_fmt  "<U0025><U0041><U002C><U0020><U0025><U0064><U0020><U0025><U0042><U0020><U006E><U0103><U006D><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
 END LC_TIME
@@ -315,7 +315,7 @@ LC_NAME
 % LC_NAME category.
 %
 name_fmt    "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074>/
-<U0025><U0067>"
+<U0025><U006D><U0025><U0074><U0025><U0067>"
 name_gen    ""
 name_mr     "<U00D4><U002E>"
 name_mrs    "<U0042><U002E>"
diff --git a/localedata/locales/xh_ZA b/localedata/locales/xh_ZA
index 806f87820b..1f61d17a82 100644
--- a/localedata/locales/xh_ZA
+++ b/localedata/locales/xh_ZA
@@ -1,7 +1,15 @@
 escape_char  /
 comment_char  %
 
+% Charset: UTF-8
+
 % ChangeLog
+% 0.3 (2005-10-13):
+%     2005-10-12 Dwayne Bailey <dwayne@translate.org.za>
+%       - Added 'Charset: UTF-8' information
+%       - Update contact information
+%       - Allign spellings of month and weekday names with Dept. of
+%         Art and Culture's: Multilingual Mathematics Dictionary
 % 0.2 (2004-11-02):
 %     2004-11-01 Dwayne Bailey <dwayne@translate.org.za>
 %       - Change all contact information
@@ -24,12 +32,12 @@ source     "Zuza Software Foundation (Translate.org.za)"
 address    "PO Box 28364, Sunnyside, 0132, South Africa"
 contact    "Dwayne Bailey"
 email      "dwayne@translate.org.za"
-tel        "+27 12 343 8389"
-fax        "+27 12 343 0389"
+tel        "+27 12 460 1095"
+fax        "+27 12 460 1095"
 language   "Xhosa"
 territory  "South Africa"
-revision   "0.2"
-date       "2004-11-02"
+revision   "0.3"
+date       "2005-10-13"
 %
 category  "xh_ZA:2003";LC_IDENTIFICATION
 category  "xh_ZA:2003";LC_CTYPE
@@ -77,39 +85,39 @@ abday       "<U0043><U0061><U0077>";/
             "<U004D><U0067><U0071>"
 %
 % The full names of the week days:
-% - Cawe, Mvulo, Lwesibini, Lwesithathu, Lwesine, Lwesihlanu, Mgqibelo
-day         "<U0043><U0061><U0077><U0065>";/
-            "<U004D><U0076><U0075><U006C><U006F>";/
-            "<U004C><U0077><U0065><U0073><U0069><U0062><U0069><U006E><U0069>";/
-            "<U004C><U0077><U0065><U0073><U0069><U0074><U0068><U0061><U0074><U0068><U0075>";/
-            "<U004C><U0077><U0065><U0073><U0069><U006E><U0065>";/
-            "<U004C><U0077><U0065><U0073><U0069><U0068><U006C><U0061><U006E><U0075>";/
-            "<U004D><U0067><U0071><U0069><U0062><U0065><U006C><U006F>"
+% - iCawa, uMvulo, lwesiBini, lwesiThathu, ulweSine, lwesiHlanu, uMgqibelo
+day         "<U0069><U0043><U0061><U0077><U0061>";/
+            "<U0075><U004D><U0076><U0075><U006C><U006F>";/
+            "<U006C><U0077><U0065><U0073><U0069><U0042><U0069><U006E><U0069>";/
+            "<U006C><U0077><U0065><U0073><U0069><U0054><U0068><U0061><U0074><U0068><U0075>";/
+            "<U0075><U006C><U0077><U0065><U0053><U0069><U006E><U0065>";/
+            "<U006C><U0077><U0065><U0073><U0069><U0048><U006C><U0061><U006E><U0075>";/
+            "<U0075><U004D><U0067><U0071><U0069><U0062><U0065><U006C><U006F>"
 %
 % The abbreviations for the months 
-% - Jan, Feb, Mat, Epr, Mey, Jun, Jul, Aga, Sep, Okt, Nov, Dis
-abmon       "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
-            "<U004D><U0061><U0074>";"<U0045><U0070><U0072>";/
-            "<U004D><U0065><U0079>";"<U004A><U0075><U006E>";/
-            "<U004A><U0075><U006C>";"<U0041><U0067><U0061>";/
-            "<U0053><U0065><U0070>";"<U004F><U006B><U0074>";/
-            "<U004E><U006F><U0076>";"<U0044><U0069><U0073>"
+% - Mqu, Mdu, Kwi, Tsh, Can, Sil, Kha, Thu, Msi, Dwa, Nka, Mng
+abmon       "<U004D><U0071><U0075>";"<U004D><U0064><U0075>";/
+            "<U004B><U0077><U0069>";"<U0054><U0073><U0068>";/
+            "<U0043><U0061><U006E>";"<U0053><U0069><U006C>";/
+            "<U004B><U0068><U0061>";"<U0054><U0068><U0075>";/
+            "<U004D><U0073><U0069>";"<U0044><U0077><U0061>";/
+            "<U004E><U006B><U0061>";"<U004D><U006E><U0067>"
 %
 % The full names of the months - 
-% - Janyuwari, Februwari, Matshi, Epreli, Meyi, Juni, Julayi, Agasti, Septemba,
-%   Okthoba, Novemba, Disemba
-mon         "<U004A><U0061><U006E><U0079><U0075><U0077><U0061><U0072><U0069>";/
-            "<U0046><U0065><U0062><U0072><U0075><U0077><U0061><U0072><U0069>";/
-            "<U004D><U0061><U0074><U0073><U0068><U0069>";/
-            "<U0045><U0070><U0072><U0065><U006C><U0069>";/
-            "<U004D><U0065><U0079><U0069>";/
-            "<U004A><U0075><U006E><U0069>";/
-            "<U004A><U0075><U006C><U0061><U0079><U0069>";/
-            "<U0041><U0067><U0061><U0073><U0074><U0069>";/
-            "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0061>";/
-            "<U004F><U006B><U0074><U0068><U006F><U0062><U0061>";/
-            "<U004E><U006F><U0076><U0065><U006D><U0062><U0061>";/
-            "<U0044><U0069><U0073><U0065><U006D><U0062><U0061>"
+% - eyoMqungu, eyoMdumba, eyoKwindla, uTshazimpuzi, uCanzibe, eyeSilimela
+%   eyeKhala, eyeThupa, eyoMsintsi, eyeDwarha, eyeNkanga, eyoMnga
+mon         "<U0065><U0079><U006F><U004D><U0071><U0075><U006E><U0067><U0075>";/
+            "<U0065><U0079><U006F><U004D><U0064><U0075><U006D><U0062><U0061>";/
+            "<U0065><U0079><U006F><U004B><U0077><U0069><U006E><U0064><U006C><U0061>";/
+            "<U0075><U0054><U0073><U0068><U0061><U007A><U0069><U006D><U0070><U0075><U007A><U0069>";/
+            "<U0075><U0043><U0061><U006E><U007A><U0069><U0062><U0065>";/
+            "<U0065><U0079><U0065><U0053><U0069><U006C><U0069><U006D><U0065><U006C><U0061>";/
+            "<U0065><U0079><U0065><U004B><U0068><U0061><U006C><U0061>";/
+            "<U0065><U0079><U0065><U0054><U0068><U0075><U0070><U0061>";/
+            "<U0065><U0079><U006F><U004D><U0073><U0069><U006E><U0074><U0073><U0069>";/
+            "<U0065><U0079><U0065><U0044><U0077><U0061><U0072><U0068><U0061>";/
+            "<U0065><U0079><U0065><U004E><U006B><U0061><U006E><U0067><U0061>";/
+            "<U0065><U0079><U006F><U004D><U006E><U0067><U0061>"
 %
 % Abreviated date and time representation to be referenced by the "%c" field descriptor -
 d_t_fmt     "<U0025><U0061><U0020><U0025><U002D><U0065><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
diff --git a/localedata/locales/zu_ZA b/localedata/locales/zu_ZA
index 45da1e5b79..9f95701199 100644
--- a/localedata/locales/zu_ZA
+++ b/localedata/locales/zu_ZA
@@ -1,7 +1,15 @@
 escape_char  /
 comment_char  %
 
+% Charset: UTF-8
+
 % ChangeLog
+% 0.3 (2005-10-13):
+%     2005-10-12 Dwayne Bailey <dwayne@translate.org.za>
+%        - Added 'Charset: UTF-8' information
+%        - Update contact information
+%        - Allign spellings of month and weekday names with Dept. of
+%          Art and Culture's: Multilingual Mathematics Dictionary
 % 0.2 (2004-10-28):
 %     2004-10-28 Dwayne Bailey <dwayne@translate.org.za>
 %        - Added lang_lib
@@ -27,12 +35,12 @@ source     "Zuza Software Foundation (Translate.org.za)"
 address    "Box 28364, Sunnyside, 0132, South Africa"
 contact    "Dwayne Bailey"
 email      "dwayne@translate.org.za"
-tel        "+27 12 343 0389"
-fax        "+27 12 448 0389"
+tel        "+27 12 460 1095"
+fax        "+27 12 460 1095"
 language   "Zulu"
 territory  "South Africa"
-revision   "0.2"
-date       "2004-10-28"
+revision   "0.3"
+date       "2005-10-13"
 %
 category  "zu_ZA:2003";LC_IDENTIFICATION
 category  "zu_ZA:2003";LC_CTYPE
@@ -82,39 +90,39 @@ abday       "<U0053><U006F><U006E>";/
             "<U004D><U0067><U0071>"
  
 % day - The full names of the week days:
-% - Sonto, Msombuluko, Lwesibili, Lwesithathu, Lwesine, Lwesihlanu, Mgqibelo
-day         "<U0053><U006F><U006E><U0074><U006F>";/
-            "<U004D><U0073><U006F><U006D><U0062><U0075><U006C><U0075><U006B><U006F>";/
-            "<U004C><U0077><U0065><U0073><U0069><U0062><U0069><U006C><U0069>";/
-            "<U004C><U0077><U0065><U0073><U0069><U0074><U0068><U0061><U0074><U0068><U0075>";/
-            "<U004C><U0077><U0065><U0073><U0069><U006E><U0065>";/
-            "<U004C><U0077><U0065><U0073><U0069><U0068><U006C><U0061><U006E><U0075>";/
-            "<U004D><U0067><U0071><U0069><U0062><U0065><U006C><U006F>"
+% - iSonto, uMsombuluko, uLwesibili, uLwesithathu, uLwesine, uLwesihlanu, uMgqibelo
+day         "<U0069><U0053><U006F><U006E><U0074><U006F>";/
+            "<U0075><U004D><U0073><U006F><U006D><U0062><U0075><U006C><U0075><U006B><U006F>";/
+            "<U0075><U004C><U0077><U0065><U0073><U0069><U0062><U0069><U006C><U0069>";/
+            "<U0075><U004C><U0077><U0065><U0073><U0069><U0074><U0068><U0061><U0074><U0068><U0075>";/
+            "<U0075><U004C><U0077><U0065><U0073><U0069><U006E><U0065>";/
+            "<U0075><U004C><U0077><U0065><U0073><U0069><U0068><U006C><U0061><U006E><U0075>";/
+            "<U0075><U004D><U0067><U0071><U0069><U0062><U0065><U006C><U006F>"
  
 % abmon - The abbreviations for the months 
-% - Jan, Feb, Mas, Apr, Mey, Jun, Jul, Aga, Sep, Okt, Nov, Dis
-abmon       "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
-            "<U004D><U0061><U0073>";"<U0041><U0070><U0072>";/
-            "<U004D><U0065><U0079>";"<U004A><U0075><U006E>";/
-            "<U004A><U0075><U006C>";"<U0041><U0067><U0061>";/
-            "<U0053><U0065><U0070>";"<U004F><U006B><U0074>";/
-            "<U004E><U006F><U0076>";"<U0044><U0069><U0073>"
+% - Mas, Ola, Nda, Mba, Aba, Ang, Ntu, Ncw, Man, Mfu, Lwe, Zib
+abmon       "<U004D><U0061><U0073>";"<U004F><U006C><U0061>";/
+            "<U004E><U0064><U0061>";"<U004D><U0062><U0061>";/
+            "<U0041><U0062><U0061>";"<U0041><U006E><U0067>";/
+            "<U004E><U0074><U0075>";"<U004E><U0063><U0077>";/
+            "<U004D><U0061><U006E>";"<U004D><U0066><U0075>";/
+            "<U004C><U0077><U0065>";"<U005A><U0069><U0062>"
  
 % mon - The full names of the months - 
-% - Januwari, Februwari, Mashi, Apreli, Meyi, Juni, Julayi, Agasti, Septemba,
-%   Okthoba, Novemba, Disemba 
-mon         "<U004A><U0061><U006E><U0075><U0077><U0061><U0072><U0069>";/
-            "<U0046><U0065><U0062><U0072><U0075><U0077><U0061><U0072><U0069>";/
-            "<U004D><U0061><U0073><U0068><U0069>";/
-            "<U0041><U0070><U0072><U0065><U006C><U0069>";/
-            "<U004D><U0065><U0079><U0069>";/
-            "<U004A><U0075><U006E><U0069>";/
-            "<U004A><U0075><U006C><U0061><U0079><U0069>";/
-            "<U0041><U0067><U0061><U0073><U0074><U0069>";/
-            "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0061>";/
-            "<U004F><U006B><U0074><U0068><U006F><U0062><U0061>";/
-            "<U004E><U006F><U0076><U0065><U006D><U0062><U0061>";/
-            "<U0044><U0069><U0073><U0065><U006D><U0062><U0061>"
+% - uMasingana, uNhlolanja, uNdasa, uMbasa, uNhlaba, uNhlangulana
+%   uNtulikazi, uNcwaba, uMandulo, uMfumfu, uLwezi, uZibandlela
+mon         "<U0075><U004D><U0061><U0073><U0069><U006E><U0067><U0061><U006E><U0061>";/
+            "<U0075><U004E><U0068><U006C><U006F><U006C><U0061><U006E><U006A><U0061>";/
+            "<U0075><U004E><U0064><U0061><U0073><U0061>";/
+            "<U0075><U004D><U0062><U0061><U0073><U0061>";/
+            "<U0075><U004E><U0068><U006C><U0061><U0062><U0061>";/
+            "<U0075><U004E><U0068><U006C><U0061><U006E><U0067><U0075><U006C><U0061><U006E><U0061>";/
+            "<U0075><U004E><U0074><U0075><U006C><U0069><U006B><U0061><U007A><U0069>";/
+            "<U0075><U004E><U0063><U0077><U0061><U0062><U0061>";/
+            "<U0075><U004D><U0061><U006E><U0064><U0075><U006C><U006F>";/
+            "<U0075><U004D><U0066><U0075><U006D><U0066><U0075>";/
+            "<U0075><U004C><U0077><U0065><U007A><U0069>";/
+            "<U0075><U005A><U0069><U0062><U0061><U006E><U0064><U006C><U0065><U006C><U0061>"
  
 % Abreviated date and time representation to be referenced by the "%c" field descriptor -
 d_t_fmt     "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
diff --git a/mach/Machrules b/mach/Machrules
index fd61833046..37693aec43 100644
--- a/mach/Machrules
+++ b/mach/Machrules
@@ -138,10 +138,11 @@ $(patsubst %,$(objpfx)%.udeps,$(user-interfaces)):
 # We must use $(CFLAGS) to get -O flags that affect #if's in header files.
 	$(include-%.defs) | \
 	$(CC) $(CFLAGS) $(CPPFLAGS) -M -x c - | \
-	sed -e 's,- *:,$@ $(@:.udeps=.ustamp) $(@:.udeps=.uh) $(@:.udeps=.__h)\
-			  $(@:.udeps=_server.c) $(@:.udeps=_server.h):,' \
+	sed -e 's,- *:,$(.udeps-targets):,' \
 	    $(sed-remove-objpfx) > $@.new
 	mv -f $@.new $@
+.udeps-targets = $@ $(@:.udeps=.ustamp) $(@:.udeps=.uh) $(@:.udeps=.__h) \
+		 $(@:.udeps=_server.c) $(@:.udeps=_server.h)
 endif
 
 # Look for the server stub files where they will be written.
diff --git a/misc/tsearch.c b/misc/tsearch.c
index 7c3a0aaa78..5ba244b015 100644
--- a/misc/tsearch.c
+++ b/misc/tsearch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>, 1997.
 
@@ -285,11 +285,12 @@ __tsearch (const void *key, void **vrootp, __compar_fn_t compar)
       q->key = key;			/* initialize new node */
       q->red = 1;
       q->left = q->right = NULL;
+
+      if (nextp != rootp)
+	/* There may be two red edges in a row now, which we must avoid by
+	   rotating the tree.  */
+	maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1);
     }
-  if (nextp != rootp)
-    /* There may be two red edges in a row now, which we must avoid by
-       rotating the tree.  */
-    maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1);
 
   return q;
 }
diff --git a/nis/Makefile b/nis/Makefile
index fa5c4dfd30..c912a2d824 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996, 1997, 1998, 2001, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1996,1997,1998,2001,2004,2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -54,7 +54,7 @@ libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
 		  nis_print_group_entry nis_domain_of nis_domain_of_r\
 		  nis_modify nis_remove nis_add nis_defaults\
 		  nis_findserv nis_callback nis_clone_dir nis_clone_obj\
-		  nis_clone_res
+		  nis_clone_res nss-default
 
 libnss_compat-routines	:= $(addprefix compat-,grp pwd spwd initgroups)
 libnss_compat-inhibit-o	= $(filter-out .os,$(object-suffixes))
diff --git a/nis/Versions b/nis/Versions
index d6b6a972f6..8cea16396f 100644
--- a/nis/Versions
+++ b/nis/Versions
@@ -57,6 +57,9 @@ libnsl {
   GLIBC_2.2 {
     xdr_ypall;
   }
+  GLIBC_PRIVATE {
+    _nsl_default_nss;
+  }
 }
 
 libnss_compat {
@@ -117,8 +120,7 @@ libnss_nisplus {
     _nss_nisplus_getservbyname_r; _nss_nisplus_getservbynumber_r;
     _nss_nisplus_getservent_r; _nss_nisplus_getspent_r;
     _nss_nisplus_getspnam_r; _nss_nisplus_netname2user;
-    _nss_nisplus_parse_grent; _nss_nisplus_parse_pwent;
-    _nss_nisplus_parse_spent; _nss_nisplus_setaliasent;
+    _nss_nisplus_setaliasent;
     _nss_nisplus_setetherent; _nss_nisplus_setgrent; _nss_nisplus_sethostent;
     _nss_nisplus_setnetent; _nss_nisplus_setnetgrent; _nss_nisplus_setprotoent;
     _nss_nisplus_setpwent; _nss_nisplus_setrpcent; _nss_nisplus_setservent;
diff --git a/nis/libnsl.h b/nis/libnsl.h
new file mode 100644
index 0000000000..e45f24df0e
--- /dev/null
+++ b/nis/libnsl.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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.  */
+
+#define NSS_FLAG_NETID_AUTHORITATIVE	1
+#define NSS_FLAG_SERVICES_AUTHORITATIVE	2
+
+
+/* Get current set of default flags.  */
+extern int _nsl_default_nss (void);
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 5b432b7981..32d29ae99f 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2001, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2001,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -428,7 +428,7 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status)
 	    return dir;
 	  }
 
-	cp = strchr (leaf, '\0');
+	cp = rawmemchr (leaf, '\0');
 	*cp++ = '.';
 	strcpy (cp, domain);
 
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 0146d53054..23c4707b6f 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -24,7 +24,7 @@
 #include "nis_intern.h"
 
 nis_result *
-nis_checkpoint(const_nis_name dirname)
+nis_checkpoint (const_nis_name dirname)
 {
   nis_result *res;
 
@@ -48,7 +48,6 @@ nis_checkpoint(const_nis_name dirname)
       if (__type_of (NIS_RES_OBJECT (res2)) != NIS_DIRECTORY_OBJ)
 	{
 	  nis_freeresult (res2);
-	  nis_freeresult (res);
 	  NIS_RES_STATUS (res) = NIS_INVALIDOBJ;
 	  return res;
 	}
diff --git a/nis/nis_clone_dir.c b/nis/nis_clone_dir.c
index 92e883fde9..f94a1eeb74 100644
--- a/nis/nis_clone_dir.c
+++ b/nis/nis_clone_dir.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -29,15 +29,24 @@ nis_clone_directory (const directory_obj *src, directory_obj *dest)
   char *addr;
   unsigned int size;
   XDR xdrs;
-  directory_obj *res;
 
   if (src == NULL)
-    return (NULL);
+    return NULL;
 
   size = xdr_sizeof ((xdrproc_t)_xdr_directory_obj, (char *)src);
   if ((addr = calloc(1, size)) == NULL)
     return NULL;
 
+  xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
+  if (!_xdr_directory_obj (&xdrs, (directory_obj *)src))
+    {
+      xdr_destroy (&xdrs);
+      free (addr);
+      return NULL;
+    }
+  xdr_destroy (&xdrs);
+
+  directory_obj *res;
   if (dest == NULL)
     {
       if ((res = calloc (1, sizeof (directory_obj))) == NULL)
@@ -49,18 +58,12 @@ nis_clone_directory (const directory_obj *src, directory_obj *dest)
   else
     res = dest;
 
-  xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
-  if (!_xdr_directory_obj (&xdrs, (directory_obj *)src))
-    {
-      xdr_destroy (&xdrs);
-      free (addr);
-      return NULL;
-    }
-  xdr_destroy (&xdrs);
   xdrmem_create (&xdrs, addr, size, XDR_DECODE);
   if (!_xdr_directory_obj (&xdrs, res))
     {
       xdr_destroy (&xdrs);
+      if (res != dest)
+	free (res);
       free (addr);
       return NULL;
     }
diff --git a/nis/nis_clone_res.c b/nis/nis_clone_res.c
index a0e098c1ed..021f7cb4f4 100644
--- a/nis/nis_clone_res.c
+++ b/nis/nis_clone_res.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -29,7 +29,6 @@ nis_clone_result (const nis_result *src, nis_result *dest)
   char *addr;
   unsigned int size;
   XDR xdrs;
-  nis_result *res;
 
   if (src == NULL)
     return (NULL);
@@ -38,6 +37,16 @@ nis_clone_result (const nis_result *src, nis_result *dest)
   if ((addr = calloc(1, size)) == NULL)
     return NULL;
 
+  xdrmem_create (&xdrs, addr, size, XDR_ENCODE);
+  if (!_xdr_nis_result (&xdrs, (nis_result *)src))
+    {
+      xdr_destroy (&xdrs);
+      free (addr);
+      return NULL;
+    }
+  xdr_destroy (&xdrs);
+
+  nis_result *res;
   if (dest == NULL)
     {
       if ((res = calloc (1, sizeof (nis_result))) == NULL)
@@ -49,18 +58,12 @@ nis_clone_result (const nis_result *src, nis_result *dest)
   else
     res = dest;
 
-  xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
-  if (!_xdr_nis_result (&xdrs, (nis_result *)src))
-    {
-      xdr_destroy (&xdrs);
-      free (addr);
-      return NULL;
-    }
-  xdr_destroy (&xdrs);
-  xdrmem_create(&xdrs, addr, size, XDR_DECODE);
-  if (!_xdr_nis_result(&xdrs, res))
+  xdrmem_create (&xdrs, addr, size, XDR_DECODE);
+  if (!_xdr_nis_result (&xdrs, res))
     {
       xdr_destroy (&xdrs);
+      if (res != dest)
+	free (res);
       free (addr);
       return NULL;
     }
diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index 3786461d64..a7808abf4b 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -46,7 +46,7 @@ nis_creategroup (const_nis_name group, unsigned int flags)
       else
 	return NIS_BADNAME;
 
-      obj = malloc (sizeof (nis_object));
+      obj = calloc (1, sizeof (nis_object));
       if (__builtin_expect (obj == NULL, 0))
 	return NIS_NOMEMORY;
 
@@ -57,7 +57,13 @@ nis_creategroup (const_nis_name group, unsigned int flags)
       obj->zo_domain = strdup (domainbuf);
       if (obj->zo_name == NULL || obj->zo_owner == NULL
 	  || obj->zo_group == NULL || obj->zo_domain == NULL)
-	return NIS_NOMEMORY;
+	{
+	  free (obj->zo_group);
+	  free (obj->zo_owner);
+	  free (obj->zo_name);
+	  free (obj);
+	  return NIS_NOMEMORY;
+	}
       obj->zo_access = __nis_default_access (NULL, 0);
       obj->zo_ttl = 60 * 60;
       obj->zo_data.zo_type = NIS_GROUP_OBJ;
@@ -66,11 +72,11 @@ nis_creategroup (const_nis_name group, unsigned int flags)
       obj->zo_data.objdata_u.gr_data.gr_members.gr_members_val = NULL;
 
       res = nis_add (buf, obj);
+      nis_free_object (obj);
       if (res == NULL)
 	return NIS_NOMEMORY;
       status = NIS_RES_STATUS (res);
       nis_freeresult (res);
-      nis_free_object (obj);
 
       return status;
     }
diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c
index 315960c8e8..e57649d526 100644
--- a/nis/nis_getservlist.c
+++ b/nis/nis_getservlist.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -40,7 +40,10 @@ nis_getservlist (const_nis_name dir)
 	malloc (sizeof (nis_server *) *
 		(NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len + 1));
       if (__builtin_expect (serv == NULL, 0))
-	return NULL;
+	{
+	  nis_freeresult (res);
+	  return NULL;
+	}
 
       for (i = 0; i < NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len;
 	   ++i)
@@ -49,13 +52,41 @@ nis_getservlist (const_nis_name dir)
 	    &NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_val[i];
 	  serv[i] = calloc (1, sizeof (nis_server));
 	  if (__builtin_expect (serv[i] == NULL, 0))
-	    return NULL;
+	    {
+	    free_all:
+	      while (i-- > 0)
+		{
+		  free (serv[i]->pkey.n_bytes);
+		  if (serv[i]->ep.ep_val != NULL)
+		    {
+		      unsigned long int j;
+		      for (j = 0; j < serv[i]->ep.ep_len; ++j)
+			{
+			  free (serv[i]->ep.ep_val[j].proto);
+			  free (serv[i]->ep.ep_val[j].family);
+			  free (serv[i]->ep.ep_val[j].uaddr);
+			}
+		      free (serv[i]->ep.ep_val);
+		    }
+		  free (serv[i]->name);
+		  free (serv[i]);
+		}
+
+	      free (serv);
+
+	      nis_freeresult (res);
+
+	      return NULL;
+	    }
 
 	  if (server->name != NULL)
 	    {
 	      serv[i]->name = strdup (server->name);
 	      if (__builtin_expect (serv[i]->name == NULL, 0))
-		return NULL;
+		{
+		  ++i;
+		  goto free_all;
+		}
 	    }
 
           serv[i]->ep.ep_len = server->ep.ep_len;
@@ -66,7 +97,10 @@ nis_getservlist (const_nis_name dir)
               serv[i]->ep.ep_val =
 		malloc (server->ep.ep_len * sizeof (endpoint));
 	      if (__builtin_expect (serv[i]->ep.ep_val == NULL, 0))
-		return NULL;
+		{
+		  ++i;
+		  goto free_all;
+		}
 
               for (j = 0; j < serv[i]->ep.ep_len; ++j)
                 {
@@ -87,20 +121,20 @@ nis_getservlist (const_nis_name dir)
 		    serv[i]->ep.ep_val[j].proto = NULL;
                 }
             }
-          else
-	    serv[i]->ep.ep_val = NULL;
+
           serv[i]->key_type = server->key_type;
           serv[i]->pkey.n_len = server->pkey.n_len;
           if (server->pkey.n_len > 0)
             {
               serv[i]->pkey.n_bytes = malloc (server->pkey.n_len);
               if (__builtin_expect (serv[i]->pkey.n_bytes == NULL, 0))
-                return NULL;
+		{
+		  ++i;
+		  goto free_all;
+		}
               memcpy (serv[i]->pkey.n_bytes, server->pkey.n_bytes,
                       server->pkey.n_len);
             }
-          else
-            serv[i]->pkey.n_bytes = NULL;
         }
       serv[i] = NULL;
     }
@@ -111,8 +145,7 @@ nis_getservlist (const_nis_name dir)
 	serv[0] = NULL;
     }
 
-  if (res != NULL)
-    nis_freeresult (res);
+  nis_freeresult (res);
 
   return serv;
 }
diff --git a/nis/nis_ismember.c b/nis/nis_ismember.c
index f3f9bc9540..178b4890ef 100644
--- a/nis/nis_ismember.c
+++ b/nis/nis_ismember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -47,8 +47,7 @@ internal_ismember (const_nis_name principal, const_nis_name group)
   res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
   if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS)
     {
-      if (res)
-	nis_freeresult (res);
+      nis_freeresult (res);
       return 0;
     }
 
diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c
index 30fd208b75..e9aea12a86 100644
--- a/nis/nis_local_names.c
+++ b/nis/nis_local_names.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -63,7 +63,7 @@ nis_local_directory (void)
 	__nisdomainname[0] = '\0';
       else
 	{
-	  char *cp = strchr (__nisdomainname, '\0');
+	  char *cp = rawmemchr (__nisdomainname, '\0');
 
 	  /* Missing trailing dot? */
 	  if (cp[-1] != '.')
@@ -154,7 +154,7 @@ nis_local_host (void)
 	__nishostname[0] = '\0';
       else
 	{
-	  char *cp = strchr (__nishostname, '\0');
+	  char *cp = rawmemchr (__nishostname, '\0');
 	  int len = cp - __nishostname;
 
 	  /* Hostname already fully qualified? */
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index d9924f9279..81afc5e8e3 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -39,8 +39,7 @@ nis_ping (const_nis_name dirname, unsigned int utime,
       res = nis_lookup (dirname, MASTER_ONLY);
       if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS)
 	{
-	  if (res)
-	    nis_freeresult (res);
+	  nis_freeresult (res);
 	  return;
 	}
       obj = res->objects.objects_val;
@@ -51,8 +50,7 @@ nis_ping (const_nis_name dirname, unsigned int utime,
   /* Check if obj is really a diryectory object */
   if (__type_of (obj) != NIS_DIRECTORY_OBJ)
     {
-      if (res != NULL)
-	nis_freeresult (res);
+      nis_freeresult (res);
       return;
     }
 
@@ -68,6 +66,5 @@ nis_ping (const_nis_name dirname, unsigned int utime,
 		   NIS_PING, (xdrproc_t) _xdr_ping_args,
 		   (caddr_t) &args, (xdrproc_t) xdr_void,
 		   (caddr_t) NULL, 0, NULL);
-  if (res)
-    nis_freeresult (res);
+  nis_freeresult (res);
 }
diff --git a/nis/nis_print_group_entry.c b/nis/nis_print_group_entry.c
index 6f0ba8fbd4..91e6399b90 100644
--- a/nis/nis_print_group_entry.c
+++ b/nis/nis_print_group_entry.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -45,12 +45,16 @@ nis_print_group_entry (const_nis_name group)
 	}
       res = nis_lookup (buf, FOLLOW_LINKS | EXPAND_NAME);
 
-      if (NIS_RES_STATUS(res) != NIS_SUCCESS)
+      if (res == NULL)
 	return;
 
-      if ((NIS_RES_NUMOBJ (res) != 1) ||
-	  (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
-	return;
+      if (NIS_RES_STATUS (res) != NIS_SUCCESS
+	  || NIS_RES_NUMOBJ (res) != 1
+	  || __type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ)
+	{
+	  nis_freeresult (res);
+	  return;
+	}
 
       char *mem_exp[NIS_RES_NUMOBJ (res)];
       char *mem_imp[NIS_RES_NUMOBJ (res)];
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index 122c3022ff..21fe13aedf 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997,1998,1999,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -68,7 +68,10 @@ nis_removemember (const_nis_name member, const_nis_name group)
 	calloc (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len,
 		sizeof (char *));
       if (newmem == NULL)
-	return NIS_NOMEMORY;
+	{
+	  nis_freeresult (res);
+	  return NIS_NOMEMORY;
+	}
 
       k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len;
       j = 0;
@@ -96,6 +99,7 @@ nis_removemember (const_nis_name member, const_nis_name group)
       if (newp == NULL)
 	{
 	  free (newmem);
+	  nis_freeresult (res);
 	  return NIS_NOMEMORY;
 	}
       newmem = newp;
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 2ef28ac59b..f56b499f60 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997,1998,1999,2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997-1999,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -41,7 +41,15 @@ __create_ib_request (const_nis_name name, unsigned int flags)
 
   /* Not of "[key=value,key=value,...],foo.." format? */
   if (cptr[0] != '[')
-    return (ibreq->ibr_name = strdup (cptr)) == NULL ? NULL : ibreq;
+    {
+      ibreq->ibr_name = strdup (cptr);
+      if (ibreq->ibr_name == NULL)
+	{
+	  free (ibreq);
+	  return NULL;
+	}
+      return ibreq;
+    }
 
   /* "[key=value,...],foo" format */
   ibreq->ibr_name = strchr (cptr, ']');
@@ -497,15 +505,7 @@ libnsl_hidden_def (nis_list)
 nis_result *
 nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
 {
-  nis_object obj;
-  nis_result *res;
-  nis_error status;
-  ib_request *ibreq;
-  size_t namelen = strlen (name);
-  char buf1[namelen + 20];
-  char buf4[namelen + 20];
-
-  res = calloc (1, sizeof (nis_result));
+  nis_result *res = calloc (1, sizeof (nis_result));
   if (res == NULL)
     return NULL;
 
@@ -515,12 +515,18 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
       return res;
     }
 
-  if ((ibreq = __create_ib_request (name, flags)) == NULL)
+  size_t namelen = strlen (name);
+  char buf1[namelen + 20];
+  char buf4[namelen + 20];
+
+  ib_request *ibreq = __create_ib_request (name, flags);
+  if (ibreq == NULL)
     {
       NIS_RES_STATUS (res) = NIS_BADNAME;
       return res;
     }
 
+  nis_object obj;
   memcpy (&obj, obj2, sizeof (nis_object));
 
   if (obj.zo_name == NULL || strlen (obj.zo_name) == 0)
@@ -543,11 +549,12 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
     }
   ibreq->ibr_obj.ibr_obj_len = 1;
 
-  if ((status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
-			      (xdrproc_t) _xdr_ib_request,
-			      (caddr_t) ibreq,
-			      (xdrproc_t) _xdr_nis_result,
-			      (caddr_t) res, 0, NULL)) != NIS_SUCCESS)
+  nis_error status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
+				   (xdrproc_t) _xdr_ib_request,
+				   (caddr_t) ibreq,
+				   (xdrproc_t) _xdr_nis_result,
+				   (caddr_t) res, 0, NULL);
+  if (status  != NIS_SUCCESS)
     NIS_RES_STATUS (res) = status;
 
   nis_free_request (ibreq);
diff --git a/nis/nss-default.c b/nis/nss-default.c
new file mode 100644
index 0000000000..3287e68b86
--- /dev/null
+++ b/nis/nss-default.c
@@ -0,0 +1,117 @@
+/* Copyright (C) 1996, 2001, 2004, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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 <ctype.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <stdlib.h>
+#include <string.h>
+#include <bits/libc-lock.h>
+
+#include <libnsl.h>
+
+
+/* Path of the file.  */
+static const char default_nss[] = "/etc/default/nss";
+
+/* Flags once read from the file.  */
+static int default_nss_flags;
+
+/* Code to make sure we call 'init' once.  */
+__libc_once_define (static, once);
+
+
+static void
+init (void)
+{
+  FILE *fp = fopen (default_nss, "rc");
+  if (fp != NULL)
+    {
+      char *line = NULL;
+      size_t linelen = 0;
+
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+      while (!feof_unlocked (fp))
+	{
+	  ssize_t n = getline (&line, &linelen, fp);
+	  if (n <= 0)
+	    break;
+
+	  /* There currently are only two variables we expect, so
+	     simplify the parsing.  Recognize only
+
+	       NETID_AUTHORITATIVE = TRUE
+	       SERVICES_AUTHORITATIVE = TRUE
+
+	     with arbitrary white spaces.  */
+	  char *cp = line;
+	  while (isspace (*cp))
+	    ++cp;
+
+	  /* Recognize comment lines.  */
+	  if (*cp == '#')
+	    continue;
+
+	  static const char netid_authoritative[] = "NETID_AUTHORITATIVE";
+	  static const char services_authoritative[]
+	    = "SERVICES_AUTHORITATIVE";
+	  size_t flag_len;
+	  if (strncmp (cp, netid_authoritative,
+		       flag_len = sizeof (netid_authoritative) - 1) != 0
+	      && strncmp (cp, services_authoritative,
+			  flag_len = sizeof (services_authoritative) - 1)
+		 != 0)
+	    continue;
+
+	  cp += flag_len;
+	  while (isspace (*cp))
+	    ++cp;
+	  if (*cp++ != '=')
+	    continue;
+	  while (isspace (*cp))
+	    ++cp;
+
+	  if (strncmp (cp, "TRUE", 4) != 0)
+	    continue;
+	  cp += 4;
+
+	  while (isspace (*cp))
+	    ++cp;
+
+	  if (*cp == '\0')
+	    default_nss_flags |= (flag_len == sizeof (netid_authoritative) - 1
+				  ? NSS_FLAG_NETID_AUTHORITATIVE
+				  : NSS_FLAG_SERVICES_AUTHORITATIVE);
+	}
+
+      free (line);
+
+      fclose (fp);
+    }
+}
+
+
+int
+_nsl_default_nss (void)
+{
+  /* If we have not yet read the file yet do it now.  */
+  __libc_once (once, init);
+
+  return default_nss_flags;
+}
diff --git a/nis/nss-nis.c b/nis/nss-nis.c
index 40370bae3b..cff1e765bb 100644
--- a/nis/nss-nis.c
+++ b/nis/nss-nis.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 2001, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,13 +16,6 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <ctype.h>
-#include <stdio.h>
-#include <stdio_ext.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rpcsvc/ypclnt.h>
-
 #include "nss-nis.h"
 #include "nsswitch.h"
 
@@ -50,81 +43,3 @@ const enum nss_status __yperr2nss_tab[] =
 };
 const unsigned int __yperr2nss_count = (sizeof (__yperr2nss_tab)
 				        / sizeof (__yperr2nss_tab[0]));
-
-int _nis_default_nss_flags;
-
-static const char default_nss[] = "/etc/default/nss";
-
-int
-_nis_check_default_nss (void)
-{
-  FILE *fp = fopen (default_nss, "rc");
-  int flags = NSS_FLAG_SET;
-  if (fp != NULL)
-    {
-      char *line = NULL;
-      size_t linelen = 0;
-
-      __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
-      while (!feof_unlocked (fp))
-	{
-	  ssize_t n = getline (&line, &linelen, fp);
-	  if (n <= 0)
-	    break;
-
-	  /* There currently are only two variables we expect, so
-	     simplify the parsing.  Recognize only
-
-	       NETID_AUTHORITATIVE = TRUE
-	       SERVICES_AUTHORITATIVE = TRUE
-
-	     with arbitrary white spaces.  */
-	  char *cp = line;
-	  while (isspace (*cp))
-	    ++cp;
-
-	  /* Recognize comment lines.  */
-	  if (*cp == '#')
-	    continue;
-
-	  static const char netid_authoritative[] = "NETID_AUTHORITATIVE";
-	  static const char services_authoritative[]
-	    = "SERVICES_AUTHORITATIVE";
-	  size_t flag_len;
-	  if (strncmp (cp, netid_authoritative,
-		       flag_len = sizeof (netid_authoritative) - 1) != 0
-	      && strncmp (cp, services_authoritative,
-			  flag_len = sizeof (services_authoritative) - 1)
-		 != 0)
-	    continue;
-
-	  cp += flag_len;
-	  while (isspace (*cp))
-	    ++cp;
-	  if (*cp++ != '=')
-	    continue;
-	  while (isspace (*cp))
-	    ++cp;
-
-	  if (strncmp (cp, "TRUE", 4) != 0)
-	    continue;
-	  cp += 4;
-
-	  while (isspace (*cp))
-	    ++cp;
-
-	  if (*cp == '\0')
-	    flags |= flag_len == sizeof (netid_authoritative) - 1
-		     ? NSS_FLAG_NETID_AUTHORITATIVE
-		     : NSS_FLAG_SERVICES_AUTHORITATIVE;
-	}
-
-      free (line);
-
-      fclose (fp);
-    }
-
-  _nis_default_nss_flags = flags;
-  return flags;
-}
diff --git a/nis/nss-nis.h b/nis/nss-nis.h
index 659b3a14aa..cdf34c648f 100644
--- a/nis/nss-nis.h
+++ b/nis/nss-nis.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -36,16 +36,4 @@ yperr2nss (int errval)
   return __yperr2nss_tab[(unsigned int) errval];
 }
 
-#define NSS_FLAG_SET			1
-#define NSS_FLAG_NETID_AUTHORITATIVE	2
-#define NSS_FLAG_SERVICES_AUTHORITATIVE	4
-extern int _nis_default_nss_flags attribute_hidden;
-extern int _nis_check_default_nss (void) attribute_hidden;
-
-extern inline __attribute__((always_inline)) int
-_nis_default_nss (void)
-{
-  return _nis_default_nss_flags ?: _nis_check_default_nss ();
-}
-
 #endif /* nis/nss-nis.h */
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 3b0887be04..9286e36ba6 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2002, 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -125,52 +125,53 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
 			    size_t buflen, int *errnop)
 {
   char *domain;
-  char *result;
-  int len;
-  char *outkey;
-  int keylen;
-  char *p;
-  int parse_res;
 
-  if (yp_get_default_domain (&domain))
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   alias->alias_local = 0;
 
   /* Get the next entry until we found a correct one. */
+  int parse_res;
   do
     {
-      enum nss_status retval;
+      char *result;
+      int len;
+      char *outkey;
+      int keylen;
+      int yperr;
 
       if (new_start)
-        retval = yperr2nss (yp_first (domain, "mail.aliases",
-				      &outkey, &keylen, &result, &len));
+        yperr = yp_first (domain, "mail.aliases", &outkey, &keylen, &result,
+			  &len);
       else
-        retval = yperr2nss ( yp_next (domain, "mail.aliases", oldkey,
-				      oldkeylen, &outkey, &keylen,
-				      &result, &len));
-      if (retval != NSS_STATUS_SUCCESS)
+        yperr = yp_next (domain, "mail.aliases", oldkey, oldkeylen, &outkey,
+			 &keylen, &result, &len);
+
+      if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
 	{
+	  enum nss_status retval = yperr2nss (yperr);
+
 	  if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
 
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
         {
 	  free (result);
           *errnop = ERANGE;
           return NSS_STATUS_TRYAGAIN;
         }
-      p = strncpy (buffer, result, len);
+      char *p = strncpy (buffer, result, len);
       buffer[len] = '\0';
       while (isspace (*p))
         ++p;
       free (result);
 
-      parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer, buflen,
-					   errnop);
-      if (parse_res == -1)
+      parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer,
+					   buflen, errnop);
+      if (__builtin_expect (parse_res == -1, 0))
 	{
 	  free (outkey);
 	  *errnop = ERANGE;
@@ -206,56 +207,55 @@ enum nss_status
 _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
 			   char *buffer, size_t buflen, int *errnop)
 {
-  enum nss_status retval;
-  int parse_res;
-  char *domain;
-  char *result;
-  int len;
-  char *p;
-  size_t namlen = strlen (name);
-  char name2[namlen + 1];
-  size_t i;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  size_t namlen = strlen (name);
+  char name2[namlen + 1];
+
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   /* Convert name to lowercase.  */
+  size_t i;
   for (i = 0; i < namlen; ++i)
     name2[i] = _tolower (name[i]);
   name2[i] = '\0';
 
-  retval = yperr2nss (yp_match (domain, "mail.aliases", name2, namlen,
-				&result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "mail.aliases", name2, namlen, &result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
   alias->alias_local = 0;
-  parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen,
+					   errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index def4c22510..a3064282ab 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -182,45 +182,46 @@ enum nss_status
 _nss_nis_gethostton_r (const char *name, struct etherent *eth,
 		       char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, parse_res;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  retval = yperr2nss (yp_match (domain, "ethers.byname", name,
-				strlen (name), &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "ethers.byname", name, strlen (name), &result,
+			&len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
+					     errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
@@ -234,54 +235,54 @@ enum nss_status
 _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
 		       char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, nlen, parse_res;
-  char buf[33];
-
   if (addr == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  nlen = sprintf (buf, "%x:%x:%x:%x:%x:%x",
-		  (int) addr->ether_addr_octet[0],
-		  (int) addr->ether_addr_octet[1],
-		  (int) addr->ether_addr_octet[2],
-		  (int) addr->ether_addr_octet[3],
-		  (int) addr->ether_addr_octet[4],
-		  (int) addr->ether_addr_octet[5]);
-
-  retval = yperr2nss (yp_match (domain, "ethers.byaddr", buf,
-				nlen, &result, &len));
-
-  if (retval != NSS_STATUS_SUCCESS)
+  char buf[33];
+  int nlen = snprintf (buf, sizeof (buf), "%x:%x:%x:%x:%x:%x",
+		      (int) addr->ether_addr_octet[0],
+		      (int) addr->ether_addr_octet[1],
+		      (int) addr->ether_addr_octet[2],
+		      (int) addr->ether_addr_octet[3],
+		      (int) addr->ether_addr_octet[4],
+		      (int) addr->ether_addr_octet[5]);
+
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "ethers.byaddr", buf, nlen, &result, &len);
+
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
+					     errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 8be7332515..68f3ced992 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999, 2001-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999, 2001-2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -71,49 +71,52 @@ static enum nss_status
 internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
 			 int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  char *domain, *result, *outkey;
-  int len, keylen, parse_res;
-
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   /* Get the next entry until we found a correct one. */
+  int parse_res;
   do
     {
-      enum nss_status retval;
-      char *p;
+      char *result;
+      char *outkey;
+      int len;
+      int keylen;
+      int yperr;
 
       if (new_start)
-        retval = yperr2nss (yp_first (domain, "group.byname",
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_first (domain, "group.byname", &outkey, &keylen, &result,
+			  &len);
       else
-        retval = yperr2nss ( yp_next (domain, "group.byname",
-                                      oldkey, oldkeylen,
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_next (domain, "group.byname", oldkey, oldkeylen, &outkey,
+			 &keylen, &result, &len);
 
-      if (retval != NSS_STATUS_SUCCESS)
+      if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
         {
+	  enum nss_status retval = yperr2nss (yperr);
+
           if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
 
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
         {
           free (result);
           *errnop = ERANGE;
           return NSS_STATUS_TRYAGAIN;
         }
 
-      p = strncpy (buffer, result, len);
+      char *p = strncpy (buffer, result, len);
       buffer[len] = '\0';
       while (isspace (*p))
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
-      if (parse_res == -1)
+      parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
+					  errnop);
+      if (__builtin_expect (parse_res == -1, 0))
 	{
 	  free (outkey);
 	  *errnop = ERANGE;
@@ -149,45 +152,46 @@ enum nss_status
 _nss_nis_getgrnam_r (const char *name, struct group *grp,
 		     char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, parse_res;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  retval = yperr2nss (yp_match (domain, "group.byname", name,
-				strlen (name), &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "group.byname", name, strlen (name), &result,
+			&len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
+					  errnop);
+  if (__builtin_expect  (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
@@ -201,42 +205,42 @@ enum nss_status
 _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
 		     char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, nlen, parse_res;
-  char buf[32];
-
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  nlen = sprintf (buf, "%lu", (unsigned long int) gid);
+  char buf[32];
+  int nlen = sprintf (buf, "%lu", (unsigned long int) gid);
 
-  retval = yperr2nss (yp_match (domain, "group.bygid", buf,
-				nlen, &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "group.bygid", buf, nlen, &result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
+					  errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index 58a9064f14..4fa0361681 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2002, 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -131,17 +131,11 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
 			   int af, int flags)
 {
   char *domain;
-  char *result;
-  int len, parse_res;
-  char *outkey;
-  int keylen;
-  struct parser_data *data = (void *) buffer;
-  size_t linebuflen = buffer + buflen - data->linebuffer;
-
-  if (yp_get_default_domain (&domain))
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  if (buflen < sizeof *data + 1)
+  struct parser_data *data = (void *) buffer;
+  if (__builtin_expect (buflen < sizeof *data + 1, 0))
     {
       *errnop = ERANGE;
       *h_errnop = NETDB_INTERNAL;
@@ -149,21 +143,26 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
     }
 
   /* Get the next entry until we found a correct one. */
+  const size_t linebuflen = buffer + buflen - data->linebuffer;
+  int parse_res;
   do
     {
-      enum nss_status retval;
-      char *p;
-
+      char *result;
+      int len;
+      char *outkey;
+      int keylen;
+      int yperr;
       if (new_start)
-        retval = yperr2nss (yp_first (domain, "hosts.byname",
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_first (domain, "hosts.byname", &outkey, &keylen, &result,
+			  &len);
       else
-        retval = yperr2nss ( yp_next (domain, "hosts.byname",
-                                      oldkey, oldkeylen,
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_next (domain, "hosts.byname", oldkey, oldkeylen, &outkey,
+			 &keylen, &result, &len);
 
-      if (retval != NSS_STATUS_SUCCESS)
+      if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
         {
+	  enum nss_status retval = yperr2nss (yperr);
+
 	  switch (retval)
 	    {
 	    case NSS_STATUS_TRYAGAIN:
@@ -180,7 +179,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
 	  return retval;
 	}
 
-      if ((size_t) (len + 1) > linebuflen)
+      if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
         {
           free (result);
 	  *h_errnop = NETDB_INTERNAL;
@@ -188,14 +187,14 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
           return NSS_STATUS_TRYAGAIN;
         }
 
-      p = strncpy (data->linebuffer, result, len);
+      char *p = strncpy (data->linebuffer, result, len);
       data->linebuffer[len] = '\0';
       while (isspace (*p))
 	++p;
       free (result);
 
       parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
-      if (parse_res == -1)
+      if (__builtin_expect (parse_res == -1, 0))
 	{
 	  free (outkey);
 	  *h_errnop = NETDB_INTERNAL;
@@ -235,11 +234,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
 			   char *buffer, size_t buflen, int *errnop,
 			   int *h_errnop, int flags)
 {
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, parse_res;
   struct parser_data *data = (void *) buffer;
-  size_t linebuflen = buffer + buflen - data->linebuffer;
 
   if (name == NULL)
     {
@@ -247,6 +242,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
       return NSS_STATUS_UNAVAIL;
     }
 
+  char *domain;
   if (yp_get_default_domain (&domain))
     return NSS_STATUS_UNAVAIL;
 
@@ -256,24 +252,24 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  else
-    {
-      /* Convert name to lowercase.  */
-      size_t namlen = strlen (name);
-      char name2[namlen + 1];
-      size_t i;
 
-      for (i = 0; i < namlen; ++i)
-	name2[i] = tolower (name[i]);
-      name2[i] = '\0';
+  /* Convert name to lowercase.  */
+  size_t namlen = strlen (name);
+  char name2[namlen + 1];
+  size_t i;
 
-      retval = yperr2nss (yp_match (domain, "hosts.byname", name2,
-				    namlen, &result, &len));
+  for (i = 0; i < namlen; ++i)
+    name2[i] = tolower (name[i]);
+  name2[i] = '\0';
 
-    }
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	{
 	  *h_errnop = TRY_AGAIN;
@@ -284,7 +280,8 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
       return retval;
     }
 
-  if ((size_t) (len + 1) > linebuflen)
+  const size_t linebuflen = buffer + buflen - data->linebuffer;
+  if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
     {
       free (result);
       *h_errnop = NETDB_INTERNAL;
@@ -292,15 +289,15 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (data->linebuffer, result, len);
+  char *p = strncpy (data->linebuffer, result, len);
   data->linebuffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
+  int parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
 
-  if (parse_res < 1 || host->h_addrtype != af)
+  if (__builtin_expect (parse_res < 1 || host->h_addrtype != af, 0))
     {
       if (parse_res == -1)
 	{
@@ -351,42 +348,42 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
 			  struct hostent *host, char *buffer, size_t buflen,
 			  int *errnop, int *h_errnop)
 {
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, parse_res;
-  char *buf;
-  struct parser_data *data = (void *) buffer;
-  size_t linebuflen = buffer + buflen - data->linebuffer;
-
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  if (buflen < sizeof *data + 1)
+  struct parser_data *data = (void *) buffer;
+  if (__builtin_expect (buflen < sizeof *data + 1, 0))
     {
       *errnop = ERANGE;
       *h_errnop = NETDB_INTERNAL;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  buf = inet_ntoa (*(const struct in_addr *) addr);
+  char *buf = inet_ntoa (*(const struct in_addr *) addr);
 
-  retval = yperr2nss (yp_match (domain, "hosts.byaddr", buf,
-                                strlen (buf), &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "hosts.byaddr", buf, strlen (buf), &result,
+			&len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	{
 	  *h_errnop = TRY_AGAIN;
 	  *errnop = errno;
 	}
-      if (retval == NSS_STATUS_NOTFOUND)
+      else if (retval == NSS_STATUS_NOTFOUND)
 	*h_errnop = HOST_NOT_FOUND;
 
       return retval;
     }
 
-  if ((size_t) (len + 1) > linebuflen)
+  const size_t linebuflen = buffer + buflen - data->linebuffer;
+  if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
     {
       free (result);
       *errnop = ERANGE;
@@ -394,15 +391,16 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (data->linebuffer, result, len);
+  char *p = strncpy (data->linebuffer, result, len);
   data->linebuffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = parse_line (p, host, data, buflen, errnop, af,
-			  ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
-  if (parse_res < 1)
+  int parse_res = parse_line (p, host, data, buflen, errnop, af,
+			      ((_res.options & RES_USE_INET6)
+			       ? AI_V4MAPPED : 0));
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	{
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index 33a9662b4c..647adf5119 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -30,6 +30,7 @@
 #include <sys/param.h>
 
 #include "nss-nis.h"
+#include <libnsl.h>
 
 /* Get the declaration of the parser function.  */
 #define ENTNAME grent
@@ -99,25 +100,23 @@ static enum nss_status
 internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
 		     int *errnop, intern_t *intern)
 {
-  struct parser_data *data = (void *) buffer;
-  int parse_res;
-  char *p;
-
   if (intern->start == NULL)
     return NSS_STATUS_NOTFOUND;
 
   /* Get the next entry until we found a correct one. */
+  int parse_res;
   do
     {
       if (intern->next == NULL)
 	return NSS_STATUS_NOTFOUND;
 
-      p = strncpy (buffer, intern->next->val, buflen);
+      char *p = strncpy (buffer, intern->next->val, buflen);
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
-      if (parse_res == -1)
+      parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
+					  errnop);
+      if (__builtin_expect (parse_res == -1, 0))
         return NSS_STATUS_TRYAGAIN;
       intern->next = intern->next->next;
     }
@@ -166,13 +165,12 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
   ssize_t keylen = snprintf (key, sizeof (key), "unix.%lu@%s",
 			     (unsigned long int) uid, domainname);
 
-  enum nss_status retval;
   char *result;
   int reslen;
-  retval = yperr2nss (yp_match (domainname, "netid.byname", key, keylen,
-				&result, &reslen));
-  if (retval != NSS_STATUS_SUCCESS)
-    return retval;
+  int yperr = yp_match (domainname, "netid.byname", key, keylen, &result,
+			&reslen);
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
+    return yperr2nss (yperr);
 
   /* Parse the result: following the colon is a comma separated list of
      group IDs.  */
@@ -207,7 +205,6 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
       if (*start == *size)
 	{
 	  /* Need a bigger buffer.  */
-	  gid_t *newgroups;
 	  long int newsize;
 
 	  if (limit > 0 && *size == limit)
@@ -219,7 +216,7 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
 	  else
 	    newsize = MIN (limit, 2 * *size);
 
-	  newgroups = realloc (groups, newsize * sizeof (*groups));
+	  gid_t *newgroups = realloc (groups, newsize * sizeof (*groups));
 	  if (newgroups == NULL)
 	    goto errout;
 	  *groupsp = groups = newgroups;
@@ -247,7 +244,7 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
     return NSS_STATUS_UNAVAIL;
 
   /* Check whether we are supposed to use the netid.byname map.  */
-  if (_nis_default_nss () & NSS_FLAG_NETID_AUTHORITATIVE)
+  if (_nsl_default_nss () & NSS_FLAG_NETID_AUTHORITATIVE)
     {
       /* We need the user ID.  */
       uid_t uid;
diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c
index 049bd8cdb4..5a88b72d9c 100644
--- a/nis/nss_nis/nis-netgrp.c
+++ b/nis/nss_nis/nis-netgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1999,2000,2002,2003,2004,2005
+/* Copyright (C) 1996,1997,1999,2000,2002,2003,2004,2005,2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -47,24 +47,25 @@ internal_nis_endnetgrent (struct __netgrent *netgrp)
   netgrp->cursor = NULL;
 }
 
+
 enum nss_status
 _nss_nis_setnetgrent (const char *group, struct __netgrent *netgrp)
 {
-  char *domain;
   int len;
   enum nss_status status;
 
   status = NSS_STATUS_SUCCESS;
 
-  if (group == NULL || group[0] == '\0')
+  if (__builtin_expect (group == NULL || group[0] == '\0', 0))
     return NSS_STATUS_UNAVAIL;
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   status = yperr2nss (yp_match (domain, "netgroup", group, strlen (group),
 				&netgrp->data, &len));
-  if (status == NSS_STATUS_SUCCESS)
+  if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
     {
       /* Our implementation of yp_match already allocates a buffer
 	 which is one byte larger than the value in LEN specifies
@@ -90,6 +91,7 @@ _nss_nis_endnetgrent (struct __netgrent *netgrp)
   return NSS_STATUS_SUCCESS;
 }
 
+
 enum nss_status
 _nss_nis_getnetgrent_r (struct __netgrent *result, char *buffer, size_t buflen,
 			int *errnop)
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index ed8439c814..9b02302e0b 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -73,28 +73,32 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
 			  int *errnop, int *herrnop)
 {
   struct parser_data *data = (void *) buffer;
-  char *domain, *result, *outkey;
-  int len, keylen, parse_res;
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   /* Get the next entry until we found a correct one. */
+  int parse_res;
   do
     {
-      enum nss_status retval;
-      char *p;
+      char *result;
+      char *outkey;
+      int len;
+      int keylen;
+      int yperr;
 
       if (new_start)
-        retval = yperr2nss (yp_first (domain, "networks.byname",
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_first (domain, "networks.byname", &outkey, &keylen, &result,
+			  &len);
       else
-        retval = yperr2nss ( yp_next (domain, "networks.byname",
-                                      oldkey, oldkeylen,
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_next (domain, "networks.byname", oldkey, oldkeylen, &outkey,
+			 &keylen, &result, &len);
 
-      if (retval != NSS_STATUS_SUCCESS)
+      if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
         {
+	  enum nss_status retval = yperr2nss (yperr);
+
           if (retval == NSS_STATUS_TRYAGAIN)
 	    {
 	      *herrnop = NETDB_INTERNAL;
@@ -103,7 +107,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
           return retval;
         }
 
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
         {
           free (result);
 	  *errnop = ERANGE;
@@ -111,14 +115,14 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
           return NSS_STATUS_TRYAGAIN;
         }
 
-      p = strncpy (buffer, result, len);
+      char *p = strncpy (buffer, result, len);
       buffer[len] = '\0';
       while (isspace (*p))
         ++p;
       free (result);
 
       parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
-      if (parse_res == -1)
+      if (__builtin_expect (parse_res == -1, 0))
 	{
 	  free (outkey);
 	  *herrnop = NETDB_INTERNAL;
@@ -155,11 +159,6 @@ enum nss_status
 _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
 			 size_t buflen, int *errnop, int *herrnop)
 {
-  enum nss_status retval;
-  struct parser_data *data = (void *) buffer;
-  char *domain, *result, *p;
-  int len, parse_res;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
@@ -167,33 +166,36 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
+  struct parser_data *data = (void *) buffer;
   if (buflen < sizeof *data + 1)
     {
       *herrnop = NETDB_INTERNAL;
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  else
-    {
-      /* Convert name to lowercase.  */
-      size_t namlen = strlen (name);
-      char name2[namlen + 1];
-      size_t i;
 
-      for (i = 0; i < namlen; ++i)
-	name2[i] = _tolower (name[i]);
-      name2[i] = '\0';
+  /* Convert name to lowercase.  */
+  size_t namlen = strlen (name);
+  char name2[namlen + 1];
+  size_t i;
 
-      retval = yperr2nss (yp_match (domain, "networks.byname", name2,
-				    namlen, &result, &len));
-    }
+  for (i = 0; i < namlen; ++i)
+    name2[i] = _tolower (name[i]);
+  name2[i] = '\0';
 
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "networks.byname", name2, namlen, &result,
+			&len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	{
 	  *errnop = errno;
@@ -202,7 +204,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
@@ -210,15 +212,15 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
+  int parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
 
-  if (parse_res < 1)
+  if (__builtin_expect (parse_res < 1, 0))
     {
       *herrnop = NETDB_INTERNAL;
       if (parse_res == -1)
@@ -235,32 +237,26 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
 			 char *buffer, size_t buflen, int *errnop,
 			 int *herrnop)
 {
-  struct parser_data *data = (void *) buffer;
   char *domain;
-  char *result;
-  int len;
-  char buf[256];
-  int blen;
-  struct in_addr in;
-  char *p;
-
-  if (yp_get_default_domain (&domain))
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  in = inet_makeaddr (addr, 0);
-  strcpy (buf, inet_ntoa (in));
-  blen = strlen (buf);
+  struct in_addr in = inet_makeaddr (addr, 0);
+  char *buf = inet_ntoa (in);
+  size_t blen = strlen (buf);
 
   while (1)
     {
-      enum nss_status retval;
-      int parse_res;
+      char *result;
+      int len;
 
-      retval = yperr2nss (yp_match (domain, "networks.byaddr", buf,
-				    strlen (buf), &result, &len));
+      int yperr = yp_match (domain, "networks.byaddr", buf, blen, &result,
+			    &len);
 
-	if (retval != NSS_STATUS_SUCCESS)
+      if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
 	  {
+	    enum nss_status retval = yperr2nss (yperr);
+
 	    if (retval == NSS_STATUS_NOTFOUND)
 	      {
 		if (buf[blen - 2] == '.' && buf[blen - 1] == '0')
@@ -282,7 +278,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
 	      }
 	  }
 
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
 	{
 	  free (result);
 	  *errnop = ERANGE;
@@ -290,15 +286,16 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
 	  return NSS_STATUS_TRYAGAIN;
 	}
 
-        p = strncpy (buffer, result, len);
+        char *p = strncpy (buffer, result, len);
 	buffer[len] = '\0';
 	while (isspace (*p))
 	  ++p;
 	free (result);
 
-	parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
+	int parse_res = _nss_files_parse_netent (p, net, (void *) buffer,
+						 buflen, errnop);
 
-	if (parse_res < 1)
+	if (__builtin_expect (parse_res < 1, 0))
 	  {
 	    *herrnop = NETDB_INTERNAL;
 	    if (parse_res == -1)
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index f1069283ab..1480a928b5 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1998, 2000-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998, 2000-2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -179,45 +179,46 @@ enum nss_status
 _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
 			   char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, parse_res;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  retval = yperr2nss (yp_match (domain, "protocols.byname", name,
-                                strlen (name), &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "protocols.byname", name, strlen (name),
+			&result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
+					     errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
@@ -231,42 +232,43 @@ enum nss_status
 _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
 			     char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, nlen, parse_res;
-  char buf[32];
-
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  nlen = sprintf (buf, "%d", number);
+  char buf[32];
+  int nlen = snprintf (buf, sizeof (buf), "%d", number);
 
-  retval = yperr2nss (yp_match (domain, "protocols.bynumber", buf,
-                                nlen, &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "protocols.bynumber", buf, nlen, &result,
+			&len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
+					     errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c
index 5aa41b8c17..f58eb154ad 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001,2002,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001,2002,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -36,10 +36,6 @@ extern int xdecrypt (char *, char *);
 enum nss_status
 _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
 {
-  enum nss_status retval;
-  char *domain, *result;
-  int len;
-
   pkey[0] = 0;
 
   if (netname == NULL)
@@ -48,19 +44,23 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
       return NSS_STATUS_UNAVAIL;
     }
 
-  domain = strchr (netname, '@');
-  if (!domain)
+  char *domain = strchr (netname, '@');
+  if (domain == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
   ++domain;
 
-  retval = yperr2nss (yp_match (domain, "publickey.byname", netname,
-				strlen (netname), &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
+			&result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
@@ -73,6 +73,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
 	*p = 0;
       strncpy (pkey, result, HEXKEYBYTES + 1);
       pkey[HEXKEYBYTES] = '\0';
+      free (result);
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -81,11 +82,6 @@ enum nss_status
 _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
 		       int *errnop)
 {
-  enum nss_status retval;
-  char buf[2 * (HEXKEYBYTES + 1)];
-  char *domain, *result;
-  int len;
-
   skey[0] = 0;
 
   if (netname == NULL || passwd == NULL)
@@ -94,19 +90,23 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
       return NSS_STATUS_UNAVAIL;
     }
 
-  domain = strchr (netname, '@');
-  if (!domain)
+  char *domain = strchr (netname, '@');
+  if (domain == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
   ++domain;
 
-  retval = yperr2nss (yp_match (domain, "publickey.byname", netname,
-				strlen (netname), &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
+			&result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
@@ -115,20 +115,22 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
   if (result != NULL)
     {
       char *p = strchr (result, ':');
-      if (p == NULL)
-	return NSS_STATUS_SUCCESS;
-
-      ++p;
-      strncpy (buf, p, 2 * (HEXKEYBYTES + 1));
-      buf[2 * HEXKEYBYTES + 1] = '\0';
-      if (!xdecrypt (buf, passwd))
-	return NSS_STATUS_SUCCESS;
-
-      if (memcmp (buf, &(buf[HEXKEYBYTES]), KEYCHECKSUMSIZE) != 0)
-	return NSS_STATUS_SUCCESS;
-
-      buf[HEXKEYBYTES] = '\0';
-      strcpy (skey, buf);
+      if (p != NULL)
+	{
+	  char buf[2 * (HEXKEYBYTES + 1)];
+
+	  ++p;
+	  strncpy (buf, p, 2 * (HEXKEYBYTES + 1));
+	  buf[2 * HEXKEYBYTES + 1] = '\0';
+	  if (xdecrypt (buf, passwd)
+	      && memcmp (buf, &(buf[HEXKEYBYTES]), KEYCHECKSUMSIZE) == 0)
+	    {
+	      buf[HEXKEYBYTES] = '\0';
+	      strcpy (skey, buf);
+	    }
+	}
+
+      free (result);
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -194,13 +196,8 @@ enum nss_status
 _nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
 		       gid_t *gidp, int *gidlenp, gid_t *gidlist, int *errnop)
 {
-  char *domain;
-  int yperr;
-  char *lookup;
-  int len;
-
-  domain = strchr (netname, '@');
-  if (!domain)
+  char *domain = strchr (netname, '@');
+  if (domain == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
@@ -208,9 +205,10 @@ _nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
 
   /* Point past the '@' character */
   ++domain;
-  lookup = NULL;
-  yperr = yp_match (domain, "netid.byname", netname, strlen (netname),
-		    &lookup, &len);
+  char *lookup = NULL;
+  int len;
+  int yperr = yp_match (domain, "netid.byname", netname, strlen (netname),
+			&lookup, &len);
   switch (yperr)
     {
     case YPERR_SUCCESS:
@@ -223,17 +221,15 @@ _nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (lookup)
-    {
-      enum nss_status err;
-
-      lookup[len] = '\0';
-      err = parse_netid_str (lookup, uidp, gidp, gidlenp, gidlist);
-      free (lookup);
-      return err;
-    }
-  else
+  if (lookup == NULL)
     return NSS_STATUS_NOTFOUND;
 
-  return NSS_STATUS_SUCCESS;
+
+  lookup[len] = '\0';
+
+  enum nss_status err = parse_netid_str (lookup, uidp, gidp, gidlenp, gidlist);
+
+  free (lookup);
+
+  return err;
 }
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index 0f56ced014..457574a49b 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -71,31 +71,31 @@ static enum nss_status
 internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
 			 int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
   char *domain;
-  int parse_res;
-
-  if (yp_get_default_domain (&domain))
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   /* Get the next entry until we found a correct one. */
+  int parse_res;
   do
     {
-      enum nss_status retval;
-      char *result, *outkey, *result2, *p;
-      int len, keylen, len2;
-      size_t namelen;
+      char *result;
+      char *outkey;
+      int len;
+      int keylen;
+      int yperr;
 
       if (new_start)
-        retval = yperr2nss (yp_first (domain, "passwd.byname",
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_first (domain, "passwd.byname", &outkey, &keylen, &result,
+			  &len);
       else
-        retval = yperr2nss ( yp_next (domain, "passwd.byname",
-                                      oldkey, oldkeylen,
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_next (domain, "passwd.byname", oldkey, oldkeylen, &outkey,
+			 &keylen, &result, &len);
 
-      if (retval != NSS_STATUS_SUCCESS)
+      if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
         {
+	  enum nss_status retval = yperr2nss (yperr);
+
           if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
@@ -103,7 +103,10 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
 
       /* Check for adjunct style secret passwords.  They can be
 	 recognized by a password starting with "##".  */
-      p = strchr (result, ':');
+      char *p = strchr (result, ':');
+      size_t namelen;
+      char *result2;
+      int len2;
       if (p != NULL	/* This better should be true in all cases.  */
 	  && p[1] == '#' && p[2] == '#'
 	  && (namelen = p - result,
@@ -128,7 +131,8 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
 	    }
 
 	  restlen = len - (p - result);
-	  if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen)
+	  if (__builtin_expect ((size_t) (namelen + (endp - encrypted)
+					  + restlen + 2) > buflen, 0))
 	    {
 	      free (result2);
 	      free (result);
@@ -147,7 +151,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
       else
 	{
 	non_adjunct:
-	  if ((size_t) (len + 1) > buflen)
+	  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
 	    {
 	      free (result);
 	      *errnop = ERANGE;
@@ -162,8 +166,9 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_pwent (p, pwd, data, buflen, errnop);
-      if (parse_res == -1)
+      parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
+					  errnop);
+      if (__builtin_expect (parse_res == -1, 0))
 	{
 	  free (outkey);
 	  *errnop = ERANGE;
@@ -199,28 +204,26 @@ enum nss_status
 _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 		     char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *result2, *p;
-  int len, len2, parse_res;
-  size_t namelen;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  namelen = strlen (name);
+  size_t namelen = strlen (name);
 
-  retval = yperr2nss (yp_match (domain, "passwd.byname", name,
-				namelen, &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "passwd.byname", name, namelen, &result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
@@ -228,7 +231,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 
   /* Check for adjunct style secret passwords.  They can be recognized
      by a password starting with "##".  */
-  p = strchr (result, ':');
+  char *result2;
+  int len2;
+  char *p = strchr (result, ':');
   if (p != NULL	/* This better should be true in all cases.  */
       && p[1] == '#' && p[2] == '#'
       && yp_match (domain, "passwd.adjunct.byname", name, namelen,
@@ -238,7 +243,6 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 	 therein into original result.  */
       char *encrypted = strchr (result2, ':');
       char *endp;
-      size_t restlen;
 
       if (encrypted == NULL
 	  || (endp = strchr (++encrypted, ':')) == NULL
@@ -251,8 +255,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 	  goto non_adjunct;
 	}
 
-      restlen = len - (p - result);
-      if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen)
+      size_t restlen = len - (p - result);
+      if (__builtin_expect ((size_t) (namelen + (endp - encrypted)
+				      + restlen + 2) > buflen, 0))
 	{
 	  free (result2);
 	  free (result);
@@ -271,7 +276,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
   else
     {
     non_adjunct:
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
 	{
 	  free (result);
 	  *errnop = ERANGE;
@@ -286,8 +291,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_pwent (p, pwd, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
+					  errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
@@ -302,23 +308,21 @@ enum nss_status
 _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
 		     char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p, *result2;
-  int len, nlen, parse_res, len2;
-  char buf[32];
-  size_t namelen;
-
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  nlen = sprintf (buf, "%lu", (unsigned long int) uid);
+  char buf[32];
+  int nlen = snprintf (buf, sizeof (buf), "%lu", (unsigned long int) uid);
 
-  retval = yperr2nss (yp_match (domain, "passwd.byuid", buf,
-				nlen, &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "passwd.byuid", buf, nlen, &result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
@@ -326,7 +330,10 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
 
   /* Check for adjunct style secret passwords.  They can be recognized
      by a password starting with "##".  */
-  p = strchr (result, ':');
+  char *result2;
+  int len2;
+  size_t namelen;
+  char *p = strchr (result, ':');
   if (p != NULL	/* This better should be true in all cases.  */
       && p[1] == '#' && p[2] == '#'
       && (namelen = p - result,
@@ -351,7 +358,8 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
 	}
 
       restlen = len - (p - result);
-      if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen)
+      if (__builtin_expect ((size_t) (namelen + (endp - encrypted)
+				      + restlen + 2) > buflen, 0))
 	{
 	  free (result2);
 	  free (result);
@@ -370,7 +378,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
   else
     {
     non_adjunct:
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
 	{
 	  free (result);
 	  *errnop = ERANGE;
@@ -385,8 +393,9 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_pwent (p, pwd, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
+					  errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index d1ab94371a..162f3572bf 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996-1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998,2000,2002,2003,2004,2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -54,7 +55,7 @@ static int
 saveit (int instatus, char *inkey, int inkeylen, char *inval,
         int invallen, char *indata)
 {
-  intern_t *intern = (intern_t *)indata;
+  intern_t *intern = (intern_t *) indata;
 
   if (instatus != YP_TRUE)
     return 1;
@@ -158,7 +159,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
         ++p;
 
       parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen, errnop);
-      if (parse_res == -1)
+      if (__builtin_expect (parse_res == -1, 0))
 	return NSS_STATUS_TRYAGAIN;
       data->next = data->next->next;
     }
@@ -186,21 +187,18 @@ enum nss_status
 _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
 			 char *buffer, size_t buflen, int *errnop)
 {
-  intern_t data = {NULL, NULL};
-  enum nss_status status;
-  int found;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  status = internal_nis_setrpcent (&data);
-  if (status != NSS_STATUS_SUCCESS)
+  intern_t data = { NULL, NULL };
+  enum nss_status status = internal_nis_setrpcent (&data);
+  if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
     return status;
 
-  found = 0;
+  int found = 0;
   while (!found &&
          ((status = internal_nis_getrpcent_r (rpc, buffer, buflen, errnop,
 					      &data)) == NSS_STATUS_SUCCESS))
@@ -226,53 +224,52 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
 
   internal_nis_endrpcent (&data);
 
-  if (!found && status == NSS_STATUS_SUCCESS)
+  if (__builtin_expect (!found && status == NSS_STATUS_SUCCESS, 0))
     return NSS_STATUS_NOTFOUND;
-  else
-    return status;
+
+  return status;
 }
 
 enum nss_status
 _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
 			   char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, nlen, parse_res;
-  char buf[32];
-
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  nlen = sprintf (buf, "%d", number);
+  char buf[32];
+  int nlen = snprintf (buf, sizeof (buf), "%d", number);
 
-  retval = yperr2nss (yp_match (domain, "rpc.bynumber", buf,
-				 nlen, &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "rpc.bynumber", buf, nlen, &result, &len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_rpcent (p, rpc, data, buflen, errnop);
-
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_rpcent (p, rpc, (void  *) buffer, buflen,
+					   errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index 1e879d04e3..40772ae743 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -27,6 +27,7 @@
 #include <rpcsvc/ypclnt.h>
 
 #include "nss-nis.h"
+#include <libnsl.h>
 
 
 /* Get the declaration of the parser function.  */
@@ -98,29 +99,26 @@ dosearch (int instatus, char *inkey, int inkeylen, char *inval,
 {
   struct search_t *req = (struct search_t *) indata;
 
-  if (instatus != YP_TRUE)
+  if (__builtin_expect (instatus != YP_TRUE, 0))
     return 1;
 
   if (inkey && inkeylen > 0 && inval && invallen > 0)
     {
-      struct parser_data *pdata = (void *) req->buffer;
-      int parse_res;
-      char *p;
-
-      if ((size_t) (invallen + 1) > req->buflen)
+      if (__builtin_expect ((size_t) (invallen + 1) > req->buflen, 0))
 	{
 	  *req->errnop = ERANGE;
 	  req->status = NSS_STATUS_TRYAGAIN;
 	  return 1;
 	}
 
-      p = strncpy (req->buffer, inval, invallen);
+      char *p = strncpy (req->buffer, inval, invallen);
       req->buffer[invallen] = '\0';
       while (isspace (*p))
         ++p;
 
-      parse_res = _nss_files_parse_servent (p, req->serv, pdata, req->buflen,
-					    req->errnop);
+      int parse_res = _nss_files_parse_servent (p, req->serv,
+						(void *) req->buffer,
+						req->buflen, req->errnop);
       if (parse_res == -1)
 	{
 	  req->status = NSS_STATUS_TRYAGAIN;
@@ -237,7 +235,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
         ++p;
 
       parse_res = _nss_files_parse_servent (p, serv, pdata, buflen, errnop);
-      if (parse_res == -1)
+      if (__builtin_expect (parse_res == -1, 0))
         return NSS_STATUS_TRYAGAIN;
       data->next = data->next->next;
     }
@@ -266,60 +264,56 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
 			  struct servent *serv, char *buffer, size_t buflen,
 			  int *errnop)
 {
-  enum nss_status status;
-  char *domain;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   /* If the protocol is given, we could try if our NIS server knows
      about services.byservicename map. If yes, we only need one query.  */
-  char key[strlen (name) + (protocol ? strlen (protocol) : 0) + 2];
-  char *cp, *result;
-  size_t keylen, len;
-  int int_len;
+  size_t keylen = strlen (name) + 1 + (protocol ? strlen (protocol) : 0);
+  char key[keylen + 1];
 
   /* key is: "name/proto" */
-  cp = stpcpy (key, name);
-  if (protocol)
+  char *cp = stpcpy (key, name);
+  if (protocol != NULL)
     {
       *cp++ = '/';
       strcpy (cp, protocol);
     }
-  keylen = strlen (key);
-  status = yperr2nss (yp_match (domain, "services.byservicename", key,
-				keylen, &result, &int_len));
-  len = int_len;
+
+  char *result;
+  int int_len;
+  enum nss_status status = yperr2nss (yp_match (domain,
+						"services.byservicename", key,
+						keylen, &result, &int_len));
+  size_t len = int_len;
 
   /* If we found the key, it's ok and parse the result. If not,
      fall through and parse the complete table. */
-  if (status == NSS_STATUS_SUCCESS)
+  if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
     {
-      struct parser_data *pdata = (void *) buffer;
-      int parse_res;
-      char *p;
-
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
 	{
 	  free (result);
 	  *errnop = ERANGE;
 	  return NSS_STATUS_TRYAGAIN;
 	}
 
-      p = strncpy (buffer, result, len);
+      char *p = strncpy (buffer, result, len);
       buffer[len] = '\0';
       while (isspace (*p))
 	++p;
       free (result);
-      parse_res = _nss_files_parse_servent (p, serv, pdata,
-					    buflen, errnop);
-      if (parse_res < 0)
+
+      int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
+						buflen, errnop);
+      if (__builtin_expect (parse_res < 0, 0))
 	{
 	  if (parse_res == -1)
 	    return NSS_STATUS_TRYAGAIN;
@@ -331,7 +325,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
     }
 
   /* Check if it is safe to rely on services.byservicename.  */
-  if (_nis_default_nss () & NSS_FLAG_SERVICES_AUTHORITATIVE)
+  if (_nsl_default_nss () & NSS_FLAG_SERVICES_AUTHORITATIVE)
     return status;
 
   struct ypall_callback ypcb;
@@ -360,10 +354,8 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
 			  struct servent *serv, char *buffer,
 			  size_t buflen, int *errnop)
 {
-  enum nss_status status;
   char *domain;
-
-  if (yp_get_default_domain (&domain))
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   /* If the protocol is given, we only need one query.
@@ -372,48 +364,45 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
   const char *proto = protocol != NULL ? protocol : "tcp";
   do
     {
+      /* key is: "port/proto" */
       char key[sizeof (int) * 3 + strlen (proto) + 2];
+      size_t keylen = snprintf (key, sizeof (key), "%d/%s", ntohs (port),
+				proto);
+
       char *result;
-      size_t keylen, len;
       int int_len;
-
-      /* key is: "port/proto" */
-      keylen = snprintf (key, sizeof (key), "%d/%s", ntohs (port), proto);
-      status = yperr2nss (yp_match (domain, "services.byname", key,
-				    keylen, &result, &int_len));
-      len = int_len;
+      enum nss_status status = yperr2nss (yp_match (domain, "services.byname",
+						    key, keylen, &result,
+						    &int_len));
+      size_t len = int_len;
 
       /* If we found the key, it's ok and parse the result. If not,
 	 fall through and parse the complete table. */
       if (status == NSS_STATUS_SUCCESS)
 	{
-	  struct parser_data *pdata = (void *) buffer;
-	  int parse_res;
-	  char *p;
-
-	  if ((size_t) (len + 1) > buflen)
+	  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
 	    {
 	      free (result);
 	      *errnop = ERANGE;
 	      return NSS_STATUS_TRYAGAIN;
 	    }
 
-	  p = strncpy (buffer, result, len);
+	  char  *p = strncpy (buffer, result, len);
 	  buffer[len] = '\0';
 	  while (isspace (*p))
 	    ++p;
 	  free (result);
-	  parse_res = _nss_files_parse_servent (p, serv, pdata,
-						buflen, errnop);
-	  if (parse_res < 0)
+	  int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
+						    buflen, errnop);
+	  if (__builtin_expect (parse_res < 0, 0))
 	    {
 	      if (parse_res == -1)
 		return NSS_STATUS_TRYAGAIN;
 	      else
 		return NSS_STATUS_NOTFOUND;
 	    }
-	  else
-	    return NSS_STATUS_SUCCESS;
+
+	  return NSS_STATUS_SUCCESS;
 	}
     }
   while (protocol == NULL && (proto[0] == 't' ? (proto = "udp") : NULL));
@@ -434,7 +423,8 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
   req.buflen = buflen;
   req.errnop = errnop;
   req.status = NSS_STATUS_NOTFOUND;
-  status = yperr2nss (yp_all (domain, "services.byname", &ypcb));
+  enum nss_status status = yperr2nss (yp_all (domain, "services.byname",
+					      &ypcb));
 
   if (status != NSS_STATUS_SUCCESS)
     return status;
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index 99a9ed5f48..820bfb25e5 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -69,48 +69,53 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
 			 int *errnop)
 {
   struct parser_data *data = (void *) buffer;
-  char *domain, *result, *outkey;
-  int len, keylen, parse_res;
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
   /* Get the next entry until we found a correct one. */
+  int parse_res;
   do
     {
-      enum nss_status retval;
-      char *p;
+      char *result;
+      char *outkey;
+      int len;
+      int keylen;
+      int yperr;
 
       if (new_start)
-        retval = yperr2nss (yp_first (domain, "shadow.byname",
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_first (domain, "shadow.byname", &outkey, &keylen, &result,
+			  &len);
       else
-        retval = yperr2nss ( yp_next (domain, "shadow.byname",
-                                      oldkey, oldkeylen,
-                                      &outkey, &keylen, &result, &len));
+        yperr = yp_next (domain, "shadow.byname", oldkey, oldkeylen, &outkey,
+			 &keylen, &result, &len);
 
-      if (retval != NSS_STATUS_SUCCESS)
+      if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
         {
+	  enum nss_status retval = yperr2nss (yperr);
+
 	  if (retval == NSS_STATUS_TRYAGAIN)
 	    *errnop = errno;
           return retval;
         }
 
-      if ((size_t) (len + 1) > buflen)
+      if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
         {
           free (result);
 	  *errnop = ERANGE;
           return NSS_STATUS_TRYAGAIN;
         }
 
-      p = strncpy (buffer, result, len);
+      char *p = strncpy (buffer, result, len);
       buffer[len] = '\0';
       while (isspace (*p))
         ++p;
       free (result);
 
-      parse_res = _nss_files_parse_spent (p, sp, data, buflen, errnop);
-      if (parse_res == -1)
+      parse_res = _nss_files_parse_spent (p, sp, (void *) buffer, buflen,
+					  errnop);
+      if (__builtin_expect  (parse_res == -1, 0))
 	{
 	  free (outkey);
 	  *errnop = ERANGE;
@@ -146,45 +151,46 @@ enum nss_status
 _nss_nis_getspnam_r (const char *name, struct spwd *sp,
 		     char *buffer, size_t buflen, int *errnop)
 {
-  struct parser_data *data = (void *) buffer;
-  enum nss_status retval;
-  char *domain, *result, *p;
-  int len, parse_res;
-
   if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (yp_get_default_domain (&domain))
+  char *domain;
+  if (__builtin_expect (yp_get_default_domain (&domain), 0))
     return NSS_STATUS_UNAVAIL;
 
-  retval = yperr2nss (yp_match (domain, "shadow.byname", name,
-				strlen (name), &result, &len));
+  char *result;
+  int len;
+  int yperr = yp_match (domain, "shadow.byname", name, strlen (name), &result,
+			&len);
 
-  if (retval != NSS_STATUS_SUCCESS)
+  if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
     {
+      enum nss_status retval = yperr2nss (yperr);
+
       if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
 
-  if ((size_t) (len + 1) > buflen)
+  if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
     {
       free (result);
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
 
-  p = strncpy (buffer, result, len);
+  char *p = strncpy (buffer, result, len);
   buffer[len] = '\0';
   while (isspace (*p))
     ++p;
   free (result);
 
-  parse_res = _nss_files_parse_spent (p, sp, data, buflen, errnop);
-  if (parse_res < 1)
+  int parse_res = _nss_files_parse_spent (p, sp, (void *) buffer, buflen,
+					  errnop);
+  if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index d7926e1566..57858721a1 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -36,11 +36,11 @@ static u_long next_entry;
 static nis_name tablename_val;
 static size_t tablename_len;
 
-#define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
 
-#define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
+#define NISENTRYLEN(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
 static enum nss_status
 _nss_create_tablename (int *errnop)
@@ -79,16 +79,12 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || __type_of (&result->objects.objects_val[entry]) != NIS_ENTRY_OBJ
-      || strcmp (result->objects.objects_val[entry].EN_data.en_type,
+      || __type_of (&NIS_RES_OBJECT (result)[entry]) != NIS_ENTRY_OBJ
+      || strcmp (NIS_RES_OBJECT (result)[entry].EN_data.en_type,
 		 "mail_aliases") != 0
-      || result->objects.objects_val[entry].EN_data.en_cols.en_cols_len < 2)
+      || NIS_RES_OBJECT (result)[entry].EN_data.en_cols.en_cols_len < 2)
     return 0;
 
-  char *first_unused = buffer + NISENTRYLEN (0, 1, result) + 1;
-  size_t room_left = (buflen - (buflen % __alignof__ (char *))
-		      - NISENTRYLEN (0, 1, result) - 2);
-
   if (NISENTRYLEN (entry, 1, result) >= buflen)
     {
       /* The line is too long for our buffer.  */
@@ -101,13 +97,15 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
 			NISENTRYLEN (entry, 1, result));
   *cp = '\0';
 
-  if (NISENTRYLEN(entry, 0, result) >= room_left)
-    goto no_more_room;
+  char *first_unused = cp + 1;
+  size_t room_left = buflen - (first_unused - buffer);
 
   alias->alias_local = 0;
   alias->alias_members_len = 0;
-  *first_unused = '\0';
-  ++first_unused;
+
+  if (NISENTRYLEN (entry, 0, result) >= room_left)
+    goto no_more_room;
+
   cp = __stpncpy (first_unused, NISENTRYVAL (entry, 0, result),
 		  NISENTRYLEN (entry, 0, result));
   *cp = '\0';
@@ -118,11 +116,20 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
   if (cp != NULL)
     *cp = '\0';
 
-  first_unused += strlen (alias->alias_name) +1;
+  size_t len = strlen (alias->alias_name) + 1;
+  first_unused += len;
+  room_left -= len;
+
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
-  first_unused += __alignof__ (char *) - 1;
-  first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
+  size_t adjust = ((__alignof__ (char *)
+		    - (first_unused - (char *) 0) % __alignof__ (char *))
+		   % __alignof__ (char *));
+  if (room_left < adjust)
+    goto no_more_room;
+  first_unused += adjust;
+  room_left -= adjust;
+
   alias->alias_members = (char **) first_unused;
 
   char *line = buffer;
@@ -146,8 +153,10 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
       if (line != alias->alias_members[alias->alias_members_len])
 	{
 	  *line++ = '\0';
-	  alias->alias_members_len++;
+	  ++alias->alias_members_len;
 	}
+      else if (*line == ',')
+	++line;
     }
 
   return alias->alias_members_len == 0 ? 0 : 1;
@@ -304,10 +313,18 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
     }
 
   if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0))
-    return niserr2nss (result->status);
+    {
+      enum nss_status status = niserr2nss (result->status);
+      nis_freeresult (result);
+      return status;
+    }
 
   parse_res = _nss_nisplus_parse_aliasent (result, 0, alias,
 					   buffer, buflen, errnop);
+
+  /* We do not need the lookup result anymore.  */
+  nis_freeresult (result);
+
   if (__builtin_expect (parse_res < 1, 0))
     {
       __set_errno (olderr);
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index ca0a9e2481..2620427243 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -38,11 +38,11 @@ static nis_name tablename_val;
 static u_long tablename_len;
 
 
-#define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].zo_data.objdata_u.en_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].zo_data.objdata_u.en_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
 
-#define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].zo_data.objdata_u.en_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
+#define NISENTRYLEN(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].zo_data.objdata_u.en_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
 static int
 _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
@@ -55,7 +55,7 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || result->objects.objects_len != 1
+      || NIS_RES_NUMOBJ (result) != 1
       || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
       || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type,
 		 "ethers_tbl") != 0
@@ -63,13 +63,15 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
     return 0;
 
   /* Generate the ether entry format and use the normal parser */
-  if (NISENTRYLEN (0, 0, result) +1 > room_left)
+  if (NISENTRYLEN (0, 0, result) + 1 > room_left)
     {
       *errnop = ERANGE;
       return -1;
     }
-  strncpy (p, NISENTRYVAL (0, 0, result), NISENTRYLEN (0, 0, result));
-  room_left -= (NISENTRYLEN (0, 0, result) +1);
+  char *cp = __stpncpy (p, NISENTRYVAL (0, 0, result),
+			NISENTRYLEN (0, 0, result));
+  *cp = '\0';
+  room_left -= NISENTRYLEN (0, 0, result) + 1;
   ether->e_name = p;
 
   struct ether_addr *ea = ether_aton (NISENTRYVAL (0, 1, result));
@@ -261,17 +263,18 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth,
 
   int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
 					       buflen, errnop);
+
+  /* We do not need the lookup result anymore.  */
+  nis_freeresult (result);
+
   if (__builtin_expect (parse_res < 1, 0))
     {
       __set_errno (olderr);
 
       if (parse_res == -1)
-	{
-	  nis_freeresult (result);
-	  return NSS_STATUS_TRYAGAIN;
-	}
-      else
-	return NSS_STATUS_NOTFOUND;
+	return NSS_STATUS_TRYAGAIN;
+
+      return NSS_STATUS_NOTFOUND;
     }
 
   return NSS_STATUS_SUCCESS;
@@ -326,13 +329,14 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
 
   int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer,
 					       buflen, errnop);
+
+  /* We do not need the lookup result anymore.  */
+  nis_freeresult (result);
+
   if (__builtin_expect (parse_res < 1, 0))
     {
       if (parse_res == -1)
-	{
-	  nis_freeresult (result);
-	  return NSS_STATUS_TRYAGAIN;
-	}
+	return NSS_STATUS_TRYAGAIN;
 
       return NSS_STATUS_NOTFOUND;
     }
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index bf002d6dd7..023e18f93d 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -36,15 +36,16 @@ static nis_result *result;
 static nis_name tablename_val;
 static u_long tablename_len;
 
-#define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
 
-#define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
+#define NISENTRYLEN(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
 /* Get implementation for some internal functions. */
 #include <resolv/mapv4v6addr.h>
 
+
 static int
 _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
 			    char *buffer, size_t buflen, int *errnop,
@@ -53,27 +54,26 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
   unsigned int i;
   char *first_unused = buffer;
   size_t room_left = buflen;
-  char *data, *p, *line;
 
   if (result == NULL)
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
-      __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
-      strcmp(result->objects.objects_val[0].EN_data.en_type,
-	     "hosts_tbl") != 0 ||
-      result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 4)
+      __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ ||
+      strcmp(NIS_RES_OBJECT (result)[0].EN_data.en_type, "hosts_tbl") != 0 ||
+      NIS_RES_OBJECT (result)[0].EN_data.en_cols.en_cols_len < 4)
     return 0;
 
-  if (room_left < NISENTRYLEN (0, 2, result) + 1)
+  char *data = first_unused;
+
+  if (room_left < (af == AF_INET6 || (flags & AI_V4MAPPED) != 0
+		   ? IN6ADDRSZ : INADDRSZ))
     {
     no_more_room:
       *errnop = ERANGE;
       return -1;
     }
 
-  data = first_unused;
-
   /* Parse address.  */
   if (af == AF_INET && inet_pton (af, NISENTRYVAL (0, 2, result), data) > 0)
     {
@@ -99,51 +99,53 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
     /* Illegal address: ignore line.  */
     return 0;
 
-  first_unused+=host->h_length;
-  room_left-=host->h_length;
+  first_unused += host->h_length;
+  room_left -= host->h_length;
 
   if (NISENTRYLEN (0, 0, result) + 1 > room_left)
     goto no_more_room;
 
-  p = __stpncpy (first_unused, NISENTRYVAL (0, 0, result),
-		 NISENTRYLEN (0, 0, result));
-  *p = '\0';
-  room_left -= (NISENTRYLEN (0, 0, result) + 1);
   host->h_name = first_unused;
-  first_unused += NISENTRYLEN (0, 0, result) +1;
-  p = first_unused;
-
-  line = p;
-  for (i = 0; i < result->objects.objects_len; ++i)
+  first_unused = __stpncpy (first_unused, NISENTRYVAL (0, 0, result),
+			    NISENTRYLEN (0, 0, result));
+  *first_unused++ = '\0';
+  room_left -= NISENTRYLEN (0, 0, result) + 1;
+
+  /* XXX Rewrite at some point to allocate the array first and then
+     copy the strings.  It wasteful to first concatenate the strings
+     to just split them again later.  */
+  char *line = first_unused;
+  for (i = 0; i < NIS_RES_NUMOBJ (result); ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
 	{
 	  if (NISENTRYLEN (i, 1, result) + 2 > room_left)
 	    goto no_more_room;
 
-	  *p++ = ' ';
-	  p = __stpncpy (p, NISENTRYVAL (i, 1, result),
-			 NISENTRYLEN (i, 1, result));
-	  *p = '\0';
-	  room_left -= (NISENTRYLEN (i, 1, result) + 1);
+	  *first_unused++ = ' ';
+	  first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
+				    NISENTRYLEN (i, 1, result));
+	  *first_unused = '\0';
+	  room_left -= NISENTRYLEN (i, 1, result) + 1;
 	}
     }
-  *p++ = '\0';
-  first_unused = p;
+  *first_unused++ = '\0';
 
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
-  first_unused += __alignof__ (char *) - 1;
-  first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
-  host->h_addr_list = (char **) first_unused;
-  if (room_left < 2 * sizeof (char *))
+  size_t adjust = ((__alignof__ (char *)
+		    - (first_unused - (char *) 0) % __alignof__ (char *))
+		   % __alignof__ (char *));
+  if (room_left < adjust + 3 * sizeof (char *))
     goto no_more_room;
+  first_unused += adjust;
+  room_left -= adjust;
+  host->h_addr_list = (char **) first_unused;
 
-  room_left -= (2 * sizeof (char *));
+  room_left -= 3 * sizeof (char *);
   host->h_addr_list[0] = data;
   host->h_addr_list[1] = NULL;
   host->h_aliases = &host->h_addr_list[2];
-  host->h_aliases[0] = NULL;
 
   i = 0;
   while (*line != '\0')
@@ -159,23 +161,21 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
 	goto no_more_room;
 
       room_left -= sizeof (char *);
-      host->h_aliases[i] = line;
+      host->h_aliases[i++] = line;
 
       while (*line != '\0' && *line != ' ')
 	++line;
 
       if (*line == ' ')
-	{
-	  *line = '\0';
-	  ++line;
-	  ++i;
-	}
-      else
-	host->h_aliases[i+1] = NULL;
+	*line++ = '\0';
     }
+
+  host->h_aliases[i] = NULL;
+
   return 1;
 }
 
+
 static enum nss_status
 _nss_create_tablename (int *errnop)
 {
diff --git a/nis/nss_nisplus/nisplus-netgrp.c b/nis/nss_nisplus/nisplus-netgrp.c
index 31a8cdf097..24303b1474 100644
--- a/nis/nss_nisplus/nisplus-netgrp.c
+++ b/nis/nss_nisplus/nisplus-netgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -27,11 +27,11 @@
 
 #include "nss-nisplus.h"
 
-#define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
 
-#define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
+#define NISENTRYLEN(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
 enum nss_status
 _nss_nisplus_getnetgrent_r (struct __netgrent *result, char *buffer,
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index 960c0558e9..468520c937 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -36,11 +36,11 @@ static nis_result *result;
 static nis_name tablename_val;
 static u_long tablename_len;
 
-#define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
 
-#define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
+#define NISENTRYLEN(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
 
 static int
@@ -54,10 +54,10 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
-      || strcmp (result->objects.objects_val[0].EN_data.en_type,
+      || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
+      || strcmp (NIS_RES_OBJECT (result)[0].EN_data.en_type,
 		 "networks_tbl") != 0
-      || result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
+      || NIS_RES_OBJECT (result)[0].EN_data.en_cols.en_cols_len < 3)
     return 0;
 
   if (NISENTRYLEN (0, 0, result) >= room_left)
@@ -72,39 +72,45 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
            NISENTRYLEN (0, 0, result));
   first_unused[NISENTRYLEN (0, 0, result)] = '\0';
   network->n_name = first_unused;
-  room_left -= (strlen (first_unused) +1);
-  first_unused += strlen (first_unused) +1;
+  size_t len = strlen (first_unused) + 1;
+  room_left -= len;
+  first_unused += len;
+
   network->n_addrtype = 0;
   network->n_net = inet_network (NISENTRYVAL (0, 2, result));
-  char *p = first_unused;
 
-  char *line = p;
-  for (unsigned int i = 0; i < result->objects.objects_len; ++i)
+  /* XXX Rewrite at some point to allocate the array first and then
+     copy the strings.  It wasteful to first concatenate the strings
+     to just split them again later.  */
+  char *line = first_unused;
+  for (unsigned int i = 0; i < NIS_RES_NUMOBJ (result); ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0)
         {
           if (NISENTRYLEN (i, 1, result) + 2 > room_left)
 	    goto no_more_room;
 
-	  *p++ = ' ';
-          p = __stpncpy (p, NISENTRYVAL (i, 1, result),
-			 NISENTRYLEN (i, 1, result));
-          *p = '\0';
+	  *first_unused++ = ' ';
+          first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
+				    NISENTRYLEN (i, 1, result));
           room_left -= (NISENTRYLEN (i, 1, result) + 1);
         }
     }
-  *p++ = '\0';
-  first_unused = p;
+  *first_unused++ = '\0';
 
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
-  first_unused += __alignof__ (char *) - 1;
-  first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
-  network->n_aliases = (char **) first_unused;
-  if (room_left < 2 * sizeof (char *))
+  size_t adjust = ((__alignof__ (char *)
+		    - (first_unused - (char *) 0) % __alignof__ (char *))
+		   % __alignof__ (char *));
+  if (room_left < adjust + sizeof (char *))
     goto no_more_room;
-  room_left -= (2 * sizeof (char *));
-  network->n_aliases[0] = NULL;
+  first_unused += adjust;
+  room_left -= adjust;
+  network->n_aliases = (char **) first_unused;
+
+  /* For the terminating NULL pointer.  */
+  room_left -= sizeof (char *);
 
   unsigned int i = 0;
   while (*line != '\0')
@@ -120,24 +126,20 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
 	goto no_more_room;
 
       room_left -= sizeof (char *);
-      network->n_aliases[i] = line;
+      network->n_aliases[i++] = line;
 
       while (*line != '\0' && *line != ' ')
         ++line;
 
       if (*line == ' ')
-	{
-	  *line = '\0';
-	  ++line;
-          ++i;
-        }
-      else
-        network->n_aliases[i + 1] = NULL;
+	*line++ = '\0';
     }
+  network->n_aliases[i] = NULL;
 
   return 1;
 }
 
+
 static enum nss_status
 _nss_create_tablename (int *errnop)
 {
@@ -443,6 +445,7 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type,
 		   removed (one by one) */
 		buf2[b2len - 2] = '\0';
 		b2len -= 2;
+		nis_freeresult (result);
 		continue;
 	      }
 
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index b61733a628..e41751fff2 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -26,10 +26,10 @@
 #include "nisplus-parser.h"
 
 #define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+        (NIS_RES_OBJECT (res)[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
 
 #define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
+        (NIS_RES_OBJECT (res)[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
 
 
 int
@@ -44,11 +44,10 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || result->objects.objects_len != 1
-      || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
-      || strcmp (result->objects.objects_val->EN_data.en_type,
-		 "passwd_tbl") != 0
-      || result->objects.objects_val->EN_data.en_cols.en_cols_len < 7)
+      || NIS_RES_NUMOBJ (result) != 1
+      || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
+      || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "passwd_tbl") != 0
+      || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 7)
     return 0;
 
   if (NISENTRYLEN (0, 0, result) >= room_left)
@@ -90,8 +89,6 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
   if (len == 0) /* If we don't have a uid, it's an invalid shadow entry */
     return 0;
   pw->pw_uid = strtoul (first_unused, NULL, 10);
-  room_left -= (len + 1);
-  first_unused += (len + 1);
 
   if (NISENTRYLEN (0, 3, result) >= room_left)
     goto no_more_room;
@@ -103,8 +100,6 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
   if (len == 0) /* If we don't have a gid, it's an invalid shadow entry */
     return 0;
   pw->pw_gid = strtoul (first_unused, NULL, 10);
-  room_left -= (len + 1);
-  first_unused += (len + 1);
 
   if (NISENTRYLEN(0, 4, result) >= room_left)
     goto no_more_room;
@@ -143,6 +138,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
 }
 libnss_nisplus_hidden_def (_nss_nisplus_parse_pwent)
 
+
 int
 _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr,
 			  char *buffer, size_t buflen, int *errnop)
@@ -157,10 +153,10 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr,
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || __type_of(result->objects.objects_val) != NIS_ENTRY_OBJ
-      || strcmp (result->objects.objects_val[entry].EN_data.en_type,
+      || __type_of(NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
+      || strcmp (NIS_RES_OBJECT (result)[entry].EN_data.en_type,
 		 "group_tbl") != 0
-      || result->objects.objects_val[entry].EN_data.en_cols.en_cols_len < 4)
+      || NIS_RES_OBJECT (result)[entry].EN_data.en_cols.en_cols_len < 4)
     return 0;
 
   if (NISENTRYLEN (entry, 0, result) >= room_left)
@@ -199,11 +195,9 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr,
 	   NISENTRYLEN (entry, 2, result));
   first_unused[NISENTRYLEN (entry, 2, result)] = '\0';
   len = strlen (first_unused);
-  if (len == 0) /* We should always have an gid */
+  if (len == 0) /* We should always have a gid */
     return 0;
   gr->gr_gid = strtoul (first_unused, NULL, 10);
-  room_left -= (strlen (first_unused) + 1);
-  first_unused += strlen (first_unused) + 1;
 
   if (NISENTRYLEN (entry, 3, result) >= room_left)
     goto no_more_room;
@@ -217,8 +211,13 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr,
   first_unused += (len + 1);
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
-  first_unused += __alignof__ (char *) - 1;
-  first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
+  size_t adjust = ((__alignof__ (char *)
+		    - (first_unused - (char *) 0) % __alignof__ (char *))
+		   % __alignof__ (char *));
+  if (room_left < adjust)
+    goto no_more_room;
+  first_unused += adjust;
+  room_left -= adjust;
   gr->gr_mem = (char **) first_unused;
 
   count = 0;
@@ -243,12 +242,10 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr,
 	{
 	  int is = isspace (*line);
 
-	  *line = '\0';
+	  *line++ = '\0';
 	  if (is)
 	    while (*line != '\0' && (*line == ',' || isspace (*line)))
 	      ++line;
-	  else
-	    ++line;
 	}
     }
   if (room_left < sizeof (char *))
@@ -260,6 +257,7 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry, struct group *gr,
 }
 libnss_nisplus_hidden_def (_nss_nisplus_parse_grent)
 
+
 int
 _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
 			  char *buffer, size_t buflen, int *errnop)
@@ -272,11 +270,10 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || result->objects.objects_len != 1
-      || __type_of(result->objects.objects_val) != NIS_ENTRY_OBJ
-      || strcmp (result->objects.objects_val->EN_data.en_type,
-		 "passwd_tbl") != 0
-      || result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 8)
+      || NIS_RES_NUMOBJ (result) != 1
+      || __type_of(NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
+      || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "passwd_tbl") != 0
+      || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 8)
     return 0;
 
   if (NISENTRYLEN (0, 0, result) >= room_left)
@@ -314,10 +311,8 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
 
   if (NISENTRYLEN (0, 7, result) > 0)
     {
-      char *line, *cp;
-
-      line = NISENTRYVAL (0, 7, result);
-      cp = strchr (line, ':');
+      char *line = NISENTRYVAL (0, 7, result);
+      char *cp = strchr (line, ':');
       if (cp == NULL)
 	return 1;
       *cp++ = '\0';
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index a3370aa85e..0b96153819 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -35,20 +35,20 @@ static nis_result *result;
 static nis_name tablename_val;
 static u_long tablename_len;
 
-#define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
+
+#define NISENTRYLEN(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
-#define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
 
 static int
-_nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
+_nss_nisplus_parse_protoent (nis_result *result, struct protoent *proto,
 			     char *buffer, size_t buflen, int *errnop)
 {
   char *first_unused = buffer;
   size_t room_left = buflen;
   unsigned int i;
-  char *p, *line;
 
   if (result == NULL)
     return 0;
@@ -71,41 +71,44 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
            NISENTRYLEN (0, 0, result));
   first_unused[NISENTRYLEN (0, 0, result)] = '\0';
   proto->p_name = first_unused;
-  room_left -= (strlen (first_unused) +1);
-  first_unused += strlen (first_unused) +1;
+  size_t len = strlen (first_unused) + 1;
+  room_left -= len;
+  first_unused += len;
 
 
-  if (NISENTRYLEN (0, 2, result) + 1 > room_left)
-    goto no_more_room;
   proto->p_proto = atoi (NISENTRYVAL (0, 2, result));
-  p = first_unused;
 
-  line = p;
-  for (i = 0; i < result->objects.objects_len; ++i)
+  /* XXX Rewrite at some point to allocate the array first and then
+     copy the strings.  It wasteful to first concatenate the strings
+     to just split them again later.  */
+  char *line = first_unused;
+  for (i = 0; i < NIS_RES_NUMOBJ (result); ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), proto->p_name) != 0)
         {
           if (NISENTRYLEN (i, 1, result) + 2 > room_left)
             goto no_more_room;
-	  *p++ = ' ';
-          p = __stpncpy (p, NISENTRYVAL (i, 1, result),
-			 NISENTRYLEN (i, 1, result));
-          *p = '\0';
-          room_left -= (NISENTRYLEN (i, 1, result) + 1);
+	  *first_unused++ = ' ';
+          first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
+				    NISENTRYLEN (i, 1, result));
+          room_left -= NISENTRYLEN (i, 1, result) + 1;
         }
     }
-  *p++ = '\0';
-  first_unused = p;
+  *first_unused++ = '\0';
 
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
-  first_unused += __alignof__ (char *) - 1;
-  first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
-  proto->p_aliases = (char **) first_unused;
-  if (room_left < sizeof (char *))
+  size_t adjust = ((__alignof__ (char *)
+		    - (first_unused - (char *) 0) % __alignof__ (char *))
+		   % __alignof__ (char *));
+  if (room_left < adjust + sizeof (char *))
     goto no_more_room;
+  first_unused += adjust;
+  room_left -= adjust;
+  proto->p_aliases = (char **) first_unused;
+
+  /* For the terminating NULL pointer.  */
   room_left -= sizeof (char *);
-  proto->p_aliases[0] = NULL;
 
   i = 0;
   while (*line != '\0')
@@ -120,20 +123,15 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
         goto no_more_room;
 
       room_left -= sizeof (char *);
-      proto->p_aliases[i] = line;
+      proto->p_aliases[i++] = line;
 
       while (*line != '\0' && *line != ' ')
         ++line;
 
       if (*line == ' ')
-        {
-          *line = '\0';
-          ++line;
-          ++i;
-        }
-      else
-        proto->p_aliases[i+1] = NULL;
+	*line++ = '\0';
     }
+  proto->p_aliases[i] = NULL;
 
   return 1;
 }
diff --git a/nis/nss_nisplus/nisplus-publickey.c b/nis/nss_nisplus/nisplus-publickey.c
index c24e898137..fe269b2c48 100644
--- a/nis/nss_nisplus/nisplus-publickey.c
+++ b/nis/nss_nisplus/nisplus-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997,1999,2001,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -91,20 +91,20 @@ _nss_nisplus_getpublickey (const char *netname, char *pkey, int *errnop)
       return retval;
     }
 
-  if (res->objects.objects_len > 1)
+  if (NIS_RES_NUMOBJ (res) > 1)
     {
       /*
        * More than one principal with same uid?
        * something wrong with cred table. Should be unique
        * Warn user and continue.
        */
-      printf (_("DES entry for netname %s not unique\n"), netname);
+      syslog (LOG_ERR, _("DES entry for netname %s not unique\n"), netname);
       nis_freeresult (res);
       return NSS_STATUS_SUCCESS;
     }
 
-  len = ENTRY_LEN (res->objects.objects_val, 3);
-  memcpy (pkey, ENTRY_VAL (res->objects.objects_val,3), len);
+  len = ENTRY_LEN (NIS_RES_OBJECT (res), 3);
+  memcpy (pkey, ENTRY_VAL (NIS_RES_OBJECT (res),3), len);
   pkey[len] = 0;
   cptr = strchr (pkey, ':');
   if (cptr)
@@ -114,6 +114,7 @@ _nss_nisplus_getpublickey (const char *netname, char *pkey, int *errnop)
   return NSS_STATUS_SUCCESS;
 }
 
+
 enum nss_status
 _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd,
 			   int *errnop)
@@ -172,20 +173,20 @@ _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd,
       return retval;
     }
 
-  if (res->objects.objects_len > 1)
+  if (NIS_RES_NUMOBJ (res) > 1)
     {
       /*
        * More than one principal with same uid?
        * something wrong with cred table. Should be unique
        * Warn user and continue.
        */
-      printf (_("DES entry for netname %s not unique\n"), netname);
+      syslog (LOG_ERR, _("DES entry for netname %s not unique\n"), netname);
       nis_freeresult (res);
       return NSS_STATUS_SUCCESS;
     }
 
-  len = ENTRY_LEN (res->objects.objects_val, 4);
-  memcpy (buf, ENTRY_VAL (res->objects.objects_val,4), len);
+  len = ENTRY_LEN (NIS_RES_OBJECT (res), 4);
+  memcpy (buf, ENTRY_VAL (NIS_RES_OBJECT (res), 4), len);
   buf[len] = '\0';
   cptr = strchr (buf, ':');
   if (cptr)
@@ -204,6 +205,7 @@ _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd,
   return NSS_STATUS_SUCCESS;
 }
 
+
 /* Parse information from the passed string.
    The format of the string passed is gid,grp,grp, ...  */
 static enum nss_status
@@ -305,7 +307,7 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (res->objects.objects_len > 1)
+  if (NIS_RES_NUMOBJ (res) > 1)
     /*
      * A netname belonging to more than one principal?
      * Something wrong with cred table. should be unique.
@@ -315,8 +317,8 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
 	    _("netname2user: DES entry for %s in directory %s not unique"),
 	    netname, domain);
 
-  len = ENTRY_LEN (res->objects.objects_val, 0);
-  strncpy (principal, ENTRY_VAL (res->objects.objects_val, 0), len);
+  len = ENTRY_LEN (NIS_RES_OBJECT (res), 0);
+  strncpy (principal, ENTRY_VAL (NIS_RES_OBJECT (res), 0), len);
   principal[len] = '\0';
   nis_freeresult (res);
 
@@ -328,7 +330,7 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
    *     LOCAL entry in **local** cred table.
    */
   domain = nis_local_directory ();
-  if ((strlen (principal) + strlen (domain) + 45) > (size_t) NIS_MAXNAMELEN)
+  if (strlen (principal) + strlen (domain) + 45 > (size_t) NIS_MAXNAMELEN)
     {
       syslog (LOG_ERR, _("netname2user: principal name `%s' too long"),
 	      principal);
@@ -379,7 +381,7 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (res->objects.objects_len > 1)
+  if (NIS_RES_NUMOBJ (res) > 1)
     /*
      * A principal can have more than one LOCAL entry?
      * Something wrong with cred table.
@@ -389,15 +391,16 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
 	    _("netname2user: LOCAL entry for %s in directory %s not unique"),
 	    netname, domain);
   /* Fetch the uid */
-  *uidp = strtoul (ENTRY_VAL (res->objects.objects_val, 2), NULL, 10);
+  *uidp = strtoul (ENTRY_VAL (NIS_RES_OBJECT (res), 2), NULL, 10);
 
   if (*uidp == 0)
     {
       syslog (LOG_ERR, _("netname2user: should not have uid 0"));
+      nis_freeresult (res);
       return NSS_STATUS_NOTFOUND;
     }
 
-  parse_grp_str (ENTRY_VAL (res->objects.objects_val, 3),
+  parse_grp_str (ENTRY_VAL (NIS_RES_OBJECT (res), 3),
 		 gidp, gidlenp, gidlist, errnop);
 
   nis_freeresult (res);
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index f6ab3fbd87..1c3faa7dc0 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -35,11 +35,12 @@ static nis_result *result;
 static nis_name tablename_val;
 static u_long tablename_len;
 
-#define NISENTRYVAL(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
+
+#define NISENTRYLEN(idx, col, res) \
+        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
-#define NISENTRYLEN(idx,col,res) \
-        ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
 
 static int
 _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
@@ -48,17 +49,16 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
   char *first_unused = buffer;
   size_t room_left = buflen;
   unsigned int i;
-  char *p, *line;
+  char *line;
 
 
   if (result == NULL)
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
-      || strcmp (result->objects.objects_val[0].EN_data.en_type,
-		 "rpc_tbl") != 0
-      || result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
+      || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
+      || strcmp (NIS_RES_OBJECT (result)[0].EN_data.en_type, "rpc_tbl") != 0
+      || NIS_RES_OBJECT (result)[0].EN_data.en_cols.en_cols_len < 3)
     return 0;
 
   if (NISENTRYLEN (0, 0, result) >= room_left)
@@ -71,37 +71,43 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
            NISENTRYLEN (0, 0, result));
   first_unused[NISENTRYLEN (0, 0, result)] = '\0';
   rpc->r_name = first_unused;
-  room_left -= (strlen (first_unused) + 1);
-  first_unused += strlen (first_unused) + 1;
+  size_t len = strlen (first_unused) + 1;
+  room_left -= len;
+  first_unused += len;
+
   rpc->r_number = atoi (NISENTRYVAL (0, 2, result));
-  p = first_unused;
 
-  line = p;
-  for (i = 0; i < result->objects.objects_len; ++i)
+  /* XXX Rewrite at some point to allocate the array first and then
+     copy the strings.  It wasteful to first concatenate the strings
+     to just split them again later.  */
+  line = first_unused;
+  for (i = 0; i < NIS_RES_NUMOBJ (result); ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), rpc->r_name) != 0)
         {
           if (NISENTRYLEN (i, 1, result) + 2 > room_left)
 	    goto no_more_room;
-	  *p++ = ' ';
-          p = __stpncpy (p, NISENTRYVAL (i, 1, result),
-			 NISENTRYLEN (i, 1, result));
-          *p = '\0';
-          room_left -= (NISENTRYLEN (i, 1, result) + 1);
+	  *first_unused++ = ' ';
+          first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
+				    NISENTRYLEN (i, 1, result));
+          room_left -= NISENTRYLEN (i, 1, result) + 1;
         }
     }
-  ++p;
-  first_unused = p;
+  *first_unused++ = '\0';
 
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
-  first_unused += __alignof__ (char *) - 1;
-  first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
-  rpc->r_aliases = (char **) first_unused;
-  if (room_left < sizeof (char *))
+  size_t adjust = ((__alignof__ (char *)
+		    - (first_unused - (char *) 0) % __alignof__ (char *))
+		   % __alignof__ (char *));
+  if (room_left < adjust + sizeof (char *))
     goto no_more_room;
+  first_unused += adjust;
+  room_left -= adjust;
+  rpc->r_aliases = (char **) first_unused;
+
+  /* For the terminating NULL pointer.  */
   room_left -= sizeof (char *);
-  rpc->r_aliases[0] = NULL;
 
   i = 0;
   while (*line != '\0')
@@ -117,24 +123,20 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
 	goto no_more_room;
 
       room_left -= sizeof (char *);
-      rpc->r_aliases[i] = line;
+      rpc->r_aliases[i++] = line;
 
       while (*line != '\0' && *line != ' ')
         ++line;
 
       if (*line == ' ')
-        {
-	  *line = '\0';
-	  ++line;
-          ++i;
-        }
-      else
-        rpc->r_aliases[i+1] = NULL;
+	*line++ = '\0';
     }
+  rpc->r_aliases[i] = NULL;
 
   return 1;
 }
 
+
 static enum nss_status
 _nss_create_tablename (int *errnop)
 {
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index c47dc09a06..3dd9f4dde6 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -35,11 +35,12 @@ static nis_result *result;
 static nis_name tablename_val;
 static u_long tablename_len;
 
-#define NISENTRYVAL(idx,col,res) \
-  ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
+#define NISENTRYVAL(idx, col, res) \
+  (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
+
+#define NISENTRYLEN(idx, col, res) \
+    (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
-#define NISENTRYLEN(idx,col,res) \
-    ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
 
 static int
 _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
@@ -52,10 +53,9 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
     return 0;
 
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS)
-      || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
-      || strcmp (result->objects.objects_val->EN_data.en_type,
-		 "services_tbl") != 0
-      || result->objects.objects_val->EN_data.en_cols.en_cols_len < 4)
+      || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
+      || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "services_tbl") != 0
+      || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 4)
     return 0;
 
   if (NISENTRYLEN (0, 0, result) >= room_left)
@@ -68,8 +68,9 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
            NISENTRYLEN (0, 0, result));
   first_unused[NISENTRYLEN (0, 0, result)] = '\0';
   serv->s_name = first_unused;
-  room_left -= (strlen (first_unused) +1);
-  first_unused += strlen (first_unused) +1;
+  size_t len = strlen (first_unused) + 1;
+  room_left -= len;
+  first_unused += len;
 
   if (NISENTRYLEN (0, 2, result) >= room_left)
     goto no_more_room;
@@ -77,38 +78,43 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
            NISENTRYLEN (0, 2, result));
   first_unused[NISENTRYLEN (0, 2, result)] = '\0';
   serv->s_proto = first_unused;
-  room_left -= strlen (first_unused) + 1;
-  first_unused += strlen (first_unused) + 1;
+  len = strlen (first_unused) + 1;
+  room_left -= len;
+  first_unused += len;
 
   serv->s_port = htons (atoi (NISENTRYVAL (0, 3, result)));
-  char *p = first_unused;
 
-  char *line = p;
-  for (unsigned int i = 0; i < result->objects.objects_len; ++i)
+  /* XXX Rewrite at some point to allocate the array first and then
+     copy the strings.  It wasteful to first concatenate the strings
+     to just split them again later.  */
+  char *line = first_unused;
+  for (unsigned int i = 0; i < NIS_RES_NUMOBJ (result); ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), serv->s_name) != 0)
         {
           if (NISENTRYLEN (i, 1, result) + 2 > room_left)
             goto no_more_room;
-	  *p++ = ' ';
-          p = __stpncpy (p, NISENTRYVAL (i, 1, result),
-			 NISENTRYLEN (i, 1, result));
-          *p = '\0';
-          room_left -= (NISENTRYLEN (i, 1, result) + 1);
+	  *first_unused++ = ' ';
+          first_unused = __stpncpy (first_unused, NISENTRYVAL (i, 1, result),
+				    NISENTRYLEN (i, 1, result));
+          room_left -= NISENTRYLEN (i, 1, result) + 1;
         }
     }
-  *p++ = '\0';
-  first_unused = p;
+  *first_unused++ = '\0';
 
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
-  first_unused += __alignof__ (char *) - 1;
-  first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
-  serv->s_aliases = (char **) first_unused;
-  if (room_left < sizeof (char *))
+  size_t adjust = ((__alignof__ (char *)
+		    - (first_unused - (char *) 0) % __alignof__ (char *))
+		   % __alignof__ (char *));
+  if (room_left < adjust + sizeof (char *))
     goto no_more_room;
+  first_unused += adjust;
+  room_left -= adjust;
+  serv->s_aliases = (char **) first_unused;
+
+  /* For the terminating NULL pointer.  */
   room_left -= (sizeof (char *));
-  serv->s_aliases[0] = NULL;
 
   unsigned int i = 0;
   while (*line != '\0')
@@ -124,24 +130,20 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
         goto no_more_room;
 
       room_left -= sizeof (char *);
-      serv->s_aliases[i] = line;
+      serv->s_aliases[i++] = line;
 
       while (*line != '\0' && *line != ' ')
         ++line;
 
       if (*line == ' ')
-        {
-	  *line = '\0';
-	  ++line;
-          ++i;
-	}
-      else
-        serv->s_aliases[i+1] = NULL;
+	*line++ = '\0';
     }
+  serv->s_aliases[i] = NULL;
 
   return 1;
 }
 
+
 static enum nss_status
 _nss_create_tablename (int *errnop)
 {
@@ -320,10 +322,10 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
 	 database is correct, we should find it in the first case, too */
       if ((result->status != NIS_SUCCESS
 	   && result->status != NIS_S_SUCCESS)
-	  || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ
-	  || strcmp (result->objects.objects_val->EN_data.en_type,
+	  || __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ
+	  || strcmp (NIS_RES_OBJECT (result)->EN_data.en_type,
 		     "services_tbl") != 0
-	  || result->objects.objects_val->EN_data.en_cols.en_cols_len < 4)
+	  || NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 4)
 	snprintf (buf, sizeof (buf), "[cname=%s,proto=%s],%s", name, protocol,
 		  tablename_val);
       else
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 78adf6aeec..65bc8d1f50 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001, 2002, 2003, 2004, 2005
+/* Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -955,16 +955,22 @@ yp_update (char *domain, char *map, unsigned ypop,
   args.update_args.datum.yp_buf_len = datalen;
   args.update_args.datum.yp_buf_val = data;
 
-  if ((r = yp_master (domain, map, &master)) != 0)
+  if ((r = yp_master (domain, map, &master)) != YPERR_SUCCESS)
     return r;
 
   if (!host2netname (servername, master, domain))
     {
       fputs (_("yp_update: cannot convert host to netname\n"), stderr);
+      free (master);
       return YPERR_YPERR;
     }
 
-  if ((clnt = clnt_create (master, YPU_PROG, YPU_VERS, "tcp")) == NULL)
+  clnt = clnt_create (master, YPU_PROG, YPU_VERS, "tcp");
+
+  /* We do not need the string anymore.  */
+  free (master);
+
+  if (clnt == NULL)
     {
       clnt_pcreateerror ("yp_update: clnt_create");
       return YPERR_RPC;
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 64cea204e3..2418fa8106 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,38 @@
+2006-04-08  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Remove branch predicion
+	suffix for conditional jumps.
+	* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Likewise.
+
+	* init.c (sigcancel_handler): Compare with correct PID even if the
+	thread is in the middle of a fork call.
+	(sighandler_setxid): Likewise.
+	Reported by Suzuki K P <suzuki@in.ibm.com> .
+
+2006-04-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* pthreadP.h (FUTEX_TID_MASK): Sync with kernel.
+
+2006-04-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* pthread_getattr_np.c (pthread_getattr_np): Close fp if getrlimit
+	fails [Coverity CID 105].
+
+2006-04-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/pthread/pthread.h: Add nonnull attributes.
+
+2006-04-03  Steven Munroe  <sjmunroe@us.ibm.com>
+
+	[BZ #2505]
+	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h [_ARCH_PWR4]:
+	Define __lll_rel_instr using lwsync.
+
 2006-03-27  Ulrich Drepper  <drepper@redhat.com>
 
 	* allocatestack.c (allocate_stack): Always initialize robust_head.
diff --git a/nptl/init.c b/nptl/init.c
index 4db3e0c828..7cfe803c42 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -148,6 +148,14 @@ static const struct pthread_functions pthread_functions =
 static void
 sigcancel_handler (int sig, siginfo_t *si, void *ctx)
 {
+#ifdef __ASSUME_CORRECT_SI_PID
+  /* Determine the process ID.  It might be negative if the thread is
+     in the middle of a fork() call.  */
+  pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
+  if (__builtin_expect (pid < 0, 0))
+    pid = -pid;
+#endif
+
   /* Safety check.  It would be possible to call this function for
      other signals and send a signal from another process.  This is not
      correct and might even be a security problem.  Try to catch as
@@ -156,7 +164,7 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx)
 #ifdef __ASSUME_CORRECT_SI_PID
       /* Kernels before 2.5.75 stored the thread ID and not the process
 	 ID in si_pid so we skip this test.  */
-      || si->si_pid != THREAD_GETMEM (THREAD_SELF, pid)
+      || si->si_pid != pid
 #endif
       || si->si_code != SI_TKILL)
     return;
@@ -201,6 +209,14 @@ struct xid_command *__xidcmd attribute_hidden;
 static void
 sighandler_setxid (int sig, siginfo_t *si, void *ctx)
 {
+#ifdef __ASSUME_CORRECT_SI_PID
+  /* Determine the process ID.  It might be negative if the thread is
+     in the middle of a fork() call.  */
+  pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
+  if (__builtin_expect (pid < 0, 0))
+    pid = -pid;
+#endif
+
   /* Safety check.  It would be possible to call this function for
      other signals and send a signal from another process.  This is not
      correct and might even be a security problem.  Try to catch as
@@ -209,7 +225,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
 #ifdef __ASSUME_CORRECT_SI_PID
       /* Kernels before 2.5.75 stored the thread ID and not the process
 	 ID in si_pid so we skip this test.  */
-      || si->si_pid != THREAD_GETMEM (THREAD_SELF, pid)
+      || si->si_pid != pid
 #endif
       || si->si_code != SI_TKILL)
     return;
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 7b3da83786..c7f57e235a 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -90,7 +90,7 @@ enum
 /* Bits used in robust mutex implementation.  */
 #define FUTEX_WAITERS		0x80000000
 #define FUTEX_OWNER_DIED	0x40000000
-#define FUTEX_TID_MASK		0x1fffffff
+#define FUTEX_TID_MASK		0x3fffffff
 
 
 /* Internal variables.  */
diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c
index ba720af6cd..4bdc7b5b15 100644
--- a/nptl/pthread_getattr_np.c
+++ b/nptl/pthread_getattr_np.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -83,51 +83,55 @@ pthread_getattr_np (thread_id, attr)
       if (fp == NULL)
 	ret = errno;
       /* We need the limit of the stack in any case.  */
-      else if (getrlimit (RLIMIT_STACK, &rl) != 0)
-	ret = errno;
       else
 	{
-	  /* We need no locking.  */
-	  __fsetlocking (fp, FSETLOCKING_BYCALLER);
+	  if (getrlimit (RLIMIT_STACK, &rl) != 0)
+	    ret = errno;
+	  else
+	    {
+	      /* We need no locking.  */
+	      __fsetlocking (fp, FSETLOCKING_BYCALLER);
 
-	  /* Until we found an entry (which should always be the case)
-	     mark the result as a failure.  */
-	  ret = ENOENT;
+	      /* Until we found an entry (which should always be the case)
+		 mark the result as a failure.  */
+	      ret = ENOENT;
 
-	  char *line = NULL;
-	  size_t linelen = 0;
-	  uintptr_t last_to = 0;
+	      char *line = NULL;
+	      size_t linelen = 0;
+	      uintptr_t last_to = 0;
 
-	  while (! feof_unlocked (fp))
-	    {
-	      if (__getdelim (&line, &linelen, '\n', fp) <= 0)
-		break;
-
-	      uintptr_t from;
-	      uintptr_t to;
-	      if (sscanf (line, "%" SCNxPTR "-%" SCNxPTR, &from, &to) != 2)
-		continue;
-	      if (from <= (uintptr_t) __libc_stack_end
-		  && (uintptr_t) __libc_stack_end < to)
+	      while (! feof_unlocked (fp))
 		{
-		  /* Found the entry.  Now we have the info we need.  */
-		  iattr->stacksize = rl.rlim_cur;
-		  iattr->stackaddr = (void *) to;
-
-		  /* The limit might be too high.  */
-		  if ((size_t) iattr->stacksize
-		      > (size_t) iattr->stackaddr - last_to)
-		    iattr->stacksize = (size_t) iattr->stackaddr - last_to;
-
-		  /* We succeed and no need to look further.  */
-		  ret = 0;
-		  break;
+		  if (__getdelim (&line, &linelen, '\n', fp) <= 0)
+		    break;
+
+		  uintptr_t from;
+		  uintptr_t to;
+		  if (sscanf (line, "%" SCNxPTR "-%" SCNxPTR, &from, &to) != 2)
+		    continue;
+		  if (from <= (uintptr_t) __libc_stack_end
+		      && (uintptr_t) __libc_stack_end < to)
+		    {
+		      /* Found the entry.  Now we have the info we need.  */
+		      iattr->stacksize = rl.rlim_cur;
+		      iattr->stackaddr = (void *) to;
+
+		      /* The limit might be too high.  */
+		      if ((size_t) iattr->stacksize
+			  > (size_t) iattr->stackaddr - last_to)
+			iattr->stacksize = (size_t) iattr->stackaddr - last_to;
+
+		      /* We succeed and no need to look further.  */
+		      ret = 0;
+		      break;
+		    }
+		  last_to = to;
 		}
-	      last_to = to;
+
+	      free (line);
 	    }
 
 	  fclose (fp);
-	  free (line);
 	}
     }
 
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index e03c374c71..5f34302e0c 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -221,7 +221,7 @@ __BEGIN_DECLS
 extern int pthread_create (pthread_t *__restrict __newthread,
 			   __const pthread_attr_t *__restrict __attr,
 			   void *(*__start_routine) (void *),
-			   void *__restrict __arg) __THROW;
+			   void *__restrict __arg) __THROW __nonnull ((1, 3));
 
 /* Terminate calling thread.
 
@@ -271,71 +271,78 @@ extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW;
 /* Initialize thread attribute *ATTR with default attributes
    (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER,
     no user-provided stack).  */
-extern int pthread_attr_init (pthread_attr_t *__attr) __THROW;
+extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
 
 /* Destroy thread attribute *ATTR.  */
-extern int pthread_attr_destroy (pthread_attr_t *__attr) __THROW;
+extern int pthread_attr_destroy (pthread_attr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Get detach state attribute.  */
 extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr,
-					int *__detachstate) __THROW;
+					int *__detachstate)
+     __THROW __nonnull ((1, 2));
 
 /* Set detach state attribute.  */
 extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
-					int __detachstate) __THROW;
+					int __detachstate)
+     __THROW __nonnull ((1));
 
 
 /* Get the size of the guard area created for stack overflow protection.  */
 extern int pthread_attr_getguardsize (__const pthread_attr_t *__attr,
-				      size_t *__guardsize) __THROW;
+				      size_t *__guardsize)
+     __THROW __nonnull ((1, 2));
 
 /* Set the size of the guard area created for stack overflow protection.  */
 extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
-				      size_t __guardsize) __THROW;
+				      size_t __guardsize)
+     __THROW __nonnull ((1));
 
 
 /* Return in *PARAM the scheduling parameters of *ATTR.  */
 extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict
 				       __attr,
 				       struct sched_param *__restrict __param)
-     __THROW;
+     __THROW __nonnull ((1, 2));
 
 /* Set scheduling parameters (priority, etc) in *ATTR according to PARAM.  */
 extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
 				       __const struct sched_param *__restrict
-				       __param) __THROW;
+				       __param) __THROW __nonnull ((1, 2));
 
 /* Return in *POLICY the scheduling policy of *ATTR.  */
 extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict
 					__attr, int *__restrict __policy)
-     __THROW;
+     __THROW __nonnull ((1, 2));
 
 /* Set scheduling policy in *ATTR according to POLICY.  */
 extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
-     __THROW;
+     __THROW __nonnull ((1));
 
 /* Return in *INHERIT the scheduling inheritance mode of *ATTR.  */
 extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict
 					 __attr, int *__restrict __inherit)
-     __THROW;
+     __THROW __nonnull ((1, 2));
 
 /* Set scheduling inheritance mode in *ATTR according to INHERIT.  */
 extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
-					 int __inherit) __THROW;
+					 int __inherit)
+     __THROW __nonnull ((1));
 
 
 /* Return in *SCOPE the scheduling contention scope of *ATTR.  */
 extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
-				  int *__restrict __scope) __THROW;
+				  int *__restrict __scope)
+     __THROW __nonnull ((1, 2));
 
 /* Set scheduling contention scope in *ATTR according to SCOPE.  */
 extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
-     __THROW;
+     __THROW __nonnull ((1));
 
 /* Return the previously set address for the stack.  */
 extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
 				      __attr, void **__restrict __stackaddr)
-     __THROW __attribute_deprecated__;
+     __THROW __nonnull ((1, 2)) __attribute_deprecated__;
 
 /* Set the starting address of the stack of the thread to be created.
    Depending on whether the stack grows up or down the value must either
@@ -343,30 +350,32 @@ extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
    minimal size of the block must be PTHREAD_STACK_MIN.  */
 extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
 				      void *__stackaddr)
-     __THROW __attribute_deprecated__;
+     __THROW __nonnull ((1)) __attribute_deprecated__;
 
 /* Return the currently used minimal stack size.  */
 extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict
 				      __attr, size_t *__restrict __stacksize)
-     __THROW;
+     __THROW __nonnull ((1, 2));
 
 /* Add information about the minimum stack size needed for the thread
    to be started.  This size must never be less than PTHREAD_STACK_MIN
    and must also not exceed the system limits.  */
 extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
-				      size_t __stacksize) __THROW;
+				      size_t __stacksize)
+     __THROW __nonnull ((1));
 
 #ifdef __USE_XOPEN2K
 /* Return the previously set address for the stack.  */
 extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
 				  void **__restrict __stackaddr,
-				  size_t *__restrict __stacksize) __THROW;
+				  size_t *__restrict __stacksize)
+     __THROW __nonnull ((1, 2, 3));
 
 /* The following two interfaces are intended to replace the last two.  They
    require setting the address as well as the size since only setting the
    address will make the implementation on some architectures impossible.  */
 extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
-				  size_t __stacksize) __THROW;
+				  size_t __stacksize) __THROW __nonnull ((1));
 #endif
 
 #ifdef __USE_GNU
@@ -374,19 +383,22 @@ extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
    the processors represented in CPUSET.  */
 extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
 					size_t __cpusetsize,
-					__const cpu_set_t *__cpuset) __THROW;
+					__const cpu_set_t *__cpuset)
+     __THROW __nonnull ((1, 3));
 
 /* Get bit set in CPUSET representing the processors threads created with
    ATTR can run on.  */
 extern int pthread_attr_getaffinity_np (__const pthread_attr_t *__attr,
 					size_t __cpusetsize,
-					cpu_set_t *__cpuset) __THROW;
+					cpu_set_t *__cpuset)
+     __THROW __nonnull ((1, 3));
 
 
 /* Initialize thread attribute *ATTR with attributes corresponding to the
    already running thread TH.  It shall be called on unitialized ATTR
    and destroyed with pthread_attr_destroy when no longer needed.  */
-extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW;
+extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr)
+     __THROW __nonnull ((2));
 #endif
 
 
@@ -396,13 +408,13 @@ extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW;
    and *PARAM.  */
 extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
 				  __const struct sched_param *__param)
-     __THROW;
+     __THROW __nonnull ((3));
 
 /* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */
 extern int pthread_getschedparam (pthread_t __target_thread,
 				  int *__restrict __policy,
 				  struct sched_param *__restrict __param)
-     __THROW;
+     __THROW __nonnull ((2, 3));
 
 /* Set the scheduling priority for TARGET_THREAD.  */
 extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
@@ -428,11 +440,13 @@ extern int pthread_yield (void) __THROW;
 /* Limit specified thread TH to run only on the processors represented
    in CPUSET.  */
 extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize,
-				   __const cpu_set_t *__cpuset) __THROW;
+				   __const cpu_set_t *__cpuset)
+     __THROW __nonnull ((3));
 
 /* Get bit set in CPUSET representing the processors TH can run on.  */
 extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
-				   cpu_set_t *__cpuset) __THROW;
+				   cpu_set_t *__cpuset)
+     __THROW __nonnull ((3));
 #endif
 
 
@@ -446,7 +460,7 @@ extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
    The initialization functions might throw exception which is why
    this function is not marked with __THROW.  */
 extern int pthread_once (pthread_once_t *__once_control,
-			 void (*__init_routine) (void));
+			 void (*__init_routine) (void)) __nonnull ((1, 2));
 
 
 /* Functions for handling cancellation.
@@ -700,26 +714,30 @@ extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
 /* Initialize a mutex.  */
 extern int pthread_mutex_init (pthread_mutex_t *__mutex,
 			       __const pthread_mutexattr_t *__mutexattr)
-     __THROW;
+     __THROW __nonnull ((1));
 
 /* Destroy a mutex.  */
-extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
+     __THROW __nonnull ((1));
 
 /* Try locking a mutex.  */
-extern int pthread_mutex_trylock (pthread_mutex_t *_mutex) __THROW;
+extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
+     __THROW __nonnull ((1));
 
 /* Lock a mutex.  */
-extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
+     __THROW __nonnull ((1));
 
 #ifdef __USE_XOPEN2K
 /* Wait until lock becomes available, or specified time passes. */
 extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
                                     __const struct timespec *__restrict
-                                    __abstime) __THROW;
+                                    __abstime) __THROW __nonnull ((1, 2));
 #endif
 
 /* Unlock a mutex.  */
-extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
+     __THROW __nonnull ((1));
 
 
 #ifdef __USE_UNIX98
@@ -727,20 +745,21 @@ extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW;
 extern int pthread_mutex_getprioceiling (__const pthread_mutex_t *
 					 __restrict __mutex,
 					 int *__restrict __prioceiling)
-     __THROW;
+     __THROW __nonnull ((1, 2));
 
 /* Set the priority ceiling of MUTEX to PRIOCEILING, return old
    priority ceiling value in *OLD_CEILING.  */
 extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
 					 int __prioceiling,
 					 int *__restrict __old_ceiling)
-     __THROW;
+     __THROW __nonnull ((1, 3));
 #endif
 
 
 #ifdef __USE_GNU
 /* Declare the state protected by MUTEX as consistent.  */
-extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)
+     __THROW __nonnull ((1));
 #endif
 
 
@@ -748,60 +767,70 @@ extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) __THROW;
 
 /* Initialize mutex attribute object ATTR with default attributes
    (kind is PTHREAD_MUTEX_TIMED_NP).  */
-extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) __THROW;
+extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Destroy mutex attribute object ATTR.  */
-extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) __THROW;
+extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Get the process-shared flag of the mutex attribute ATTR.  */
 extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *
 					 __restrict __attr,
-					 int *__restrict __pshared) __THROW;
+					 int *__restrict __pshared)
+     __THROW __nonnull ((1, 2));
 
 /* Set the process-shared flag of the mutex attribute ATTR.  */
 extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
-					 int __pshared) __THROW;
+					 int __pshared)
+     __THROW __nonnull ((1));
 
 #ifdef __USE_UNIX98
 /* Return in *KIND the mutex kind attribute in *ATTR.  */
 extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
-				      __attr, int *__restrict __kind) __THROW;
+				      __attr, int *__restrict __kind)
+     __THROW __nonnull ((1, 2));
 
 /* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL,
    PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or
    PTHREAD_MUTEX_DEFAULT).  */
 extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
-     __THROW;
+     __THROW __nonnull ((1));
 
 /* Return in *PROTOCOL the mutex protocol attribute in *ATTR.  */
 extern int pthread_mutexattr_getprotocol (__const pthread_mutexattr_t *
 					  __restrict __attr,
-					  int *__restrict __protocol) __THROW;
+					  int *__restrict __protocol)
+     __THROW __nonnull ((1, 2));
 
 /* Set the mutex protocol attribute in *ATTR to PROTOCOL (either
    PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT).  */
 extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
-					  int __protocol) __THROW;
+					  int __protocol)
+     __THROW __nonnull ((1));
 
 /* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR.  */
 extern int pthread_mutexattr_getprioceiling (__const pthread_mutexattr_t *
 					     __restrict __attr,
 					     int *__restrict __prioceiling)
-     __THROW;
+     __THROW __nonnull ((1, 2));
 
 /* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING.  */
 extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
-					     int __prioceiling) __THROW;
+					     int __prioceiling)
+     __THROW __nonnull ((1));
 #endif
 
 #ifdef __USE_GNU
 /* Get the robustness flag of the mutex attribute ATTR.  */
 extern int pthread_mutexattr_getrobust_np (__const pthread_mutexattr_t *__attr,
-					   int *__robustness) __THROW;
+					   int *__robustness)
+     __THROW __nonnull ((1, 2));
 
 /* Set the robustness flag of the mutex attribute ATTR.  */
 extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
-					   int __robustness) __THROW;
+					   int __robustness)
+     __THROW __nonnull ((1));
 #endif
 
 
@@ -812,66 +841,77 @@ extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
    the default values if later is NULL.  */
 extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
 				__const pthread_rwlockattr_t *__restrict
-				__attr) __THROW;
+				__attr) __THROW __nonnull ((1));
 
 /* Destroy read-write lock RWLOCK.  */
-extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
+     __THROW __nonnull ((1));
 
 /* Acquire read lock for RWLOCK.  */
-extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
+     __THROW __nonnull ((1));
 
 /* Try to acquire read lock for RWLOCK.  */
-extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
+  __THROW __nonnull ((1));
 
 # ifdef __USE_XOPEN2K
 /* Try to acquire read lock for RWLOCK or return after specfied time.  */
 extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
 				       __const struct timespec *__restrict
-				       __abstime) __THROW;
+				       __abstime) __THROW __nonnull ((1, 2));
 # endif
 
 /* Acquire write lock for RWLOCK.  */
-extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
+     __THROW __nonnull ((1));
 
 /* Try to acquire write lock for RWLOCK.  */
-extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
+     __THROW __nonnull ((1));
 
 # ifdef __USE_XOPEN2K
 /* Try to acquire write lock for RWLOCK or return after specfied time.  */
 extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
 				       __const struct timespec *__restrict
-				       __abstime) __THROW;
+				       __abstime) __THROW __nonnull ((1, 2));
 # endif
 
 /* Unlock RWLOCK.  */
-extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
+     __THROW __nonnull ((1));
 
 
 /* Functions for handling read-write lock attributes.  */
 
 /* Initialize attribute object ATTR with default values.  */
-extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) __THROW;
+extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Destroy attribute object ATTR.  */
-extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) __THROW;
+extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Return current setting of process-shared attribute of ATTR in PSHARED.  */
 extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t *
 					  __restrict __attr,
-					  int *__restrict __pshared) __THROW;
+					  int *__restrict __pshared)
+     __THROW __nonnull ((1, 2));
 
 /* Set process-shared attribute of ATTR to PSHARED.  */
 extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
-					  int __pshared) __THROW;
+					  int __pshared)
+     __THROW __nonnull ((1));
 
 /* Return current setting of reader/writer preference.  */
 extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *
 					  __restrict __attr,
-					  int *__restrict __pref) __THROW;
+					  int *__restrict __pref)
+     __THROW __nonnull ((1, 2));
 
 /* Set reader/write preference.  */
 extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
-					  int __pref) __THROW;
+					  int __pref) __THROW __nonnull ((1));
 #endif
 
 
@@ -881,16 +921,19 @@ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
    the default values if later is NULL.  */
 extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
 			      __const pthread_condattr_t *__restrict
-			      __cond_attr) __THROW;
+			      __cond_attr) __THROW __nonnull ((1));
 
 /* Destroy condition variable COND.  */
-extern int pthread_cond_destroy (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_destroy (pthread_cond_t *__cond)
+     __THROW __nonnull ((1));
 
 /* Wake up one thread waiting for condition variable COND.  */
-extern int pthread_cond_signal (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_signal (pthread_cond_t *__cond)
+     __THROW __nonnull ((1));
 
 /* Wake up all threads waiting for condition variables COND.  */
-extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_broadcast (pthread_cond_t *__cond)
+     __THROW __nonnull ((1));
 
 /* Wait for condition variable COND to be signaled or broadcast.
    MUTEX is assumed to be locked before.
@@ -898,7 +941,8 @@ extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW;
    This function is a cancellation point and therefore not marked with
    __THROW.  */
 extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
-			      pthread_mutex_t *__restrict __mutex);
+			      pthread_mutex_t *__restrict __mutex)
+     __nonnull ((1, 2));
 
 /* Wait for condition variable COND to be signaled or broadcast until
    ABSTIME.  MUTEX is assumed to be locked before.  ABSTIME is an
@@ -910,36 +954,39 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
 extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
 				   pthread_mutex_t *__restrict __mutex,
 				   __const struct timespec *__restrict
-				   __abstime);
+				   __abstime) __nonnull ((1, 2, 3));
 
 /* Functions for handling condition variable attributes.  */
 
 /* Initialize condition variable attribute ATTR.  */
-extern int pthread_condattr_init (pthread_condattr_t *__attr) __THROW;
+extern int pthread_condattr_init (pthread_condattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Destroy condition variable attribute ATTR.  */
-extern int pthread_condattr_destroy (pthread_condattr_t *__attr) __THROW;
+extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Get the process-shared flag of the condition variable attribute ATTR.  */
 extern int pthread_condattr_getpshared (__const pthread_condattr_t *
                                         __restrict __attr,
-                                        int *__restrict __pshared) __THROW;
+                                        int *__restrict __pshared)
+     __THROW __nonnull ((1, 2));
 
 /* Set the process-shared flag of the condition variable attribute ATTR.  */
 extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
-                                        int __pshared) __THROW;
+                                        int __pshared) __THROW __nonnull ((1));
 
 #ifdef __USE_XOPEN2K
 /* Get the clock selected for the conditon variable attribute ATTR.  */
 extern int pthread_condattr_getclock (__const pthread_condattr_t *
 				      __restrict __attr,
 				      __clockid_t *__restrict __clock_id)
-     __THROW;
+     __THROW __nonnull ((1, 2));
 
 /* Set the clock selected for the conditon variable attribute ATTR.  */
 extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
-				      __clockid_t __clock_id) __THROW;
-
+				      __clockid_t __clock_id)
+     __THROW __nonnull ((1));
 #endif
 
 
@@ -949,19 +996,23 @@ extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
 /* Initialize the spinlock LOCK.  If PSHARED is nonzero the spinlock can
    be shared between different processes.  */
 extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
-     __THROW;
+     __THROW __nonnull ((1));
 
 /* Destroy the spinlock LOCK.  */
-extern int pthread_spin_destroy (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
+     __THROW __nonnull ((1));
 
 /* Wait until spinlock LOCK is retrieved.  */
-extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_lock (pthread_spinlock_t *__lock)
+     __THROW __nonnull ((1));
 
 /* Try to lock spinlock LOCK.  */
-extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
+     __THROW __nonnull ((1));
 
 /* Release spinlock LOCK.  */
-extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
+     __THROW __nonnull ((1));
 
 
 /* Functions to handle barriers.  */
@@ -970,29 +1021,36 @@ extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW;
    opened when COUNT waiters arrived.  */
 extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
 				 __const pthread_barrierattr_t *__restrict
-				 __attr, unsigned int __count) __THROW;
+				 __attr, unsigned int __count)
+     __THROW __nonnull ((1));
 
 /* Destroy a previously dynamically initialized barrier BARRIER.  */
-extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) __THROW;
+extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
+     __THROW __nonnull ((1));
 
 /* Wait on barrier BARRIER.  */
-extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW;
+extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
+     __THROW __nonnull ((1));
 
 
 /* Initialize barrier attribute ATTR.  */
-extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) __THROW;
+extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Destroy previously dynamically initialized barrier attribute ATTR.  */
-extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) __THROW;
+extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
+     __THROW __nonnull ((1));
 
 /* Get the process-shared flag of the barrier attribute ATTR.  */
 extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
 					   __restrict __attr,
-					   int *__restrict __pshared) __THROW;
+					   int *__restrict __pshared)
+     __THROW __nonnull ((1, 2));
 
 /* Set the process-shared flag of the barrier attribute ATTR.  */
 extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
-                                           int __pshared) __THROW;
+                                           int __pshared)
+     __THROW __nonnull ((1));
 #endif
 
 
@@ -1005,7 +1063,8 @@ extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
    DESTR_FUNCTION is not called if the value associated is NULL when
    the key is destroyed.  */
 extern int pthread_key_create (pthread_key_t *__key,
-			       void (*__destr_function) (void *)) __THROW;
+			       void (*__destr_function) (void *))
+     __THROW __nonnull ((1));
 
 /* Destroy KEY.  */
 extern int pthread_key_delete (pthread_key_t __key) __THROW;
@@ -1015,13 +1074,14 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW;
 
 /* Store POINTER in the thread-specific data slot identified by KEY. */
 extern int pthread_setspecific (pthread_key_t __key,
-				__const void *__pointer) __THROW;
+				__const void *__pointer) __THROW ;
 
 
 #ifdef __USE_XOPEN2K
 /* Get ID of CPU-time clock for thread THREAD_ID.  */
 extern int pthread_getcpuclockid (pthread_t __thread_id,
-				  __clockid_t *__clock_id) __THROW;
+				  __clockid_t *__clock_id)
+     __THROW __nonnull ((2));
 #endif
 
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
index 223b111083..88885b735d 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
@@ -22,7 +22,7 @@
 #ifndef UP
 # define LOCK \
 	cmpl	$0, %gs:MULTIPLE_THREADS_OFFSET; 			      \
-	je,pt	0f;							      \
+	je	0f;							      \
 	lock;								      \
 0:
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index 9acd81ae5a..e2da5b04cf 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -67,7 +67,7 @@ __lll_mutex_lock_wait:
 	xchgl	%eax, (%ebx)	/* NB:	 lock is implied */
 
 	testl	%eax, %eax
-	jnz,pn	1b
+	jnz	1b
 
 	popl	%esi
 	cfi_adjust_cfa_offset(-4)
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
index 114284c44c..fe7a8b9c66 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
@@ -82,7 +82,7 @@ pthread_barrier_wait:
 #else
 	cmpl	%edx, CURR_EVENT(%ebx)
 #endif
-	je,pn	8b
+	je	8b
 
 	/* Increment LEFT.  If this brings the count back to the
 	   initial count unlock the object.  */
@@ -92,7 +92,7 @@ pthread_barrier_wait:
 	xaddl	%edx, LEFT(%ebx)
 	subl	$1, %ecx
 	cmpl	%ecx, %edx
-	jne,pt	10f
+	jne	10f
 
 	/* Release the mutex.  We cannot release the lock before
 	   waking the waiting threads since otherwise a new thread might
@@ -131,7 +131,7 @@ pthread_barrier_wait:
 	xaddl	%edx, LEFT(%ebx)
 	subl	$1, %ecx
 	cmpl	%ecx, %edx
-	jne,pt	5f
+	jne	5f
 
 	/* Release the mutex.  We cannot release the lock before
 	   waking the waiting threads since otherwise a new thread might
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
index 318b53a873..aa1f9f41ca 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
@@ -49,12 +49,12 @@ sem_timedwait:
 
 	movl	(%ecx), %eax
 2:	testl	%eax, %eax
-	je,pn	1f
+	je	1f
 
 	leal	-1(%eax), %edx
 	LOCK
 	cmpxchgl %edx, (%ecx)
-	jne,pn	2b
+	jne	2b
 
 	xorl	%eax, %eax
 	ret
@@ -117,7 +117,7 @@ sem_timedwait:
 	call	__pthread_disable_asynccancel
 
 	testl	%esi, %esi
-	je,pt	9f
+	je	9f
 	cmpl	$-EWOULDBLOCK, %esi
 	jne	3f
 
@@ -128,7 +128,7 @@ sem_timedwait:
 	leal	-1(%eax), %ecx
 	LOCK
 	cmpxchgl %ecx, (%ebx)
-	jne,pn	8b
+	jne	8b
 
 	addl	$12, %esp
 	cfi_adjust_cfa_offset(-12)
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
index d36a1088fb..fbc3b3c932 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S
@@ -42,7 +42,7 @@ __new_sem_trywait:
 	leal	-1(%eax), %edx
 	LOCK
 	cmpxchgl %edx, (%ecx)
-	jne,pn	2b
+	jne	2b
 	xorl	%eax, %eax
 	ret
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
index 3e908aef9c..b1296275d0 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S
@@ -62,7 +62,7 @@ __new_sem_wait:
 	leal	-1(%eax), %edx
 	LOCK
 	cmpxchgl %edx, (%ebx)
-	jne,pn	2b
+	jne	2b
 	xorl	%eax, %eax
 
 	movl	4(%esp), %esi
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
index 23e81f4e4b..e405f84f25 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -474,7 +474,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 # define lll_trylock(futex) \
   ({ unsigned char ret;							      \
      __asm __volatile ("cmpl $0, %%gs:%P5\n\t"				      \
-		       "je,pt 0f\n\t"					      \
+		       "je 0f\n\t"					      \
 		       "lock\n"						      \
 		       "0:\tcmpxchgl %2, %1; setne %0"			      \
 		       : "=a" (ret), "=m" (futex)			      \
@@ -488,7 +488,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 # define lll_lock(futex) \
   (void) ({ int ignore1, ignore2;					      \
 	    __asm __volatile ("cmpl $0, %%gs:%P6\n\t"			      \
-			      "je,pt 0f\n\t"				      \
+			      "je 0f\n\t"				      \
 			      "lock\n"					      \
 			      "0:\tcmpxchgl %1, %2\n\t"			      \
 			      "jnz _L_lock_%=\n\t"			      \
@@ -511,7 +511,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 # define lll_unlock(futex) \
   (void) ({ int ignore;							      \
             __asm __volatile ("cmpl $0, %%gs:%P3\n\t"			      \
-			      "je,pt 0f\n\t"				      \
+			      "je 0f\n\t"				      \
 			      "lock\n"					      \
 			      "0:\tsubl $1,%0\n\t"			      \
 			      "jne _L_unlock_%=\n\t"			      \
@@ -551,7 +551,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 			"1:\tmovl %1, %%eax\n\t"			      \
 			LLL_ENTER_KERNEL				      \
 			"cmpl $0, (%%ebx)\n\t"				      \
-			"jne,pn 1b\n\t"					      \
+			"jne 1b\n\t"					      \
 			LLL_EBX_LOAD					      \
 			: "=&a" (__ignore)				      \
 			: "i" (SYS_futex), LLL_EBX_REG (&tid), "S" (0),	      \
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index fcc1240fef..abd019df47 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
@@ -110,7 +110,21 @@
 # define __lll_rel_instr	""
 #else
 # define __lll_acq_instr	"isync"
-# define __lll_rel_instr	"sync"
+# ifdef _ARCH_PWR4
+/*
+ * Newer powerpc64 processors support the new "light weight" sync (lwsync)
+ * So if the build is using -mcpu=[power4,power5,power5+,970] we can
+ * safely use lwsync.
+ */
+#  define __lll_rel_instr	"lwsync"
+# else
+/*
+ * Older powerpc32 processors don't support the new "light weight"
+ * sync (lwsync).  So the only safe option is to use normal sync
+ * for all powerpc32 applications.
+ */
+#  define __lll_rel_instr	"sync"
+# endif
 #endif
 
 /* Set *futex to ID if it is 0, atomically.  Returns the old value */
diff --git a/nscd/Makefile b/nscd/Makefile
index e91c289a4f..0b35964e7b 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -1,4 +1,5 @@
-# Copyright (C) 1998,2000,2002,2003,2004,2005 Free Software Foundation, Inc.
+# Copyright (C) 1998,2000,2002,2003,2004,2005,2006
+#	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -58,9 +59,6 @@ endif
 
 nscd-modules += selinux
 selinux-LIBS := -lselinux $(libaudit)
-endif
-
-LDLIBS-nscd = $(selinux-LIBS)
 
 # The configure.in check for libselinux and its headers did not use
 # $SYSINCLUDES.  The directory specified by --with-headers usually
@@ -69,6 +67,9 @@ LDLIBS-nscd = $(selinux-LIBS)
 # system headers will be ok for this file.
 $(objpfx)nscd_stat.o: sysincludes = # nothing
 $(objpfx)selinux.o: sysincludes = # nothing
+endif
+
+LDLIBS-nscd = $(selinux-LIBS)
 
 distribute := nscd.h nscd-client.h dbg_log.h \
 	      $(addsuffix .c, $(filter-out xmalloc,$(all-nscd-modules))) \
diff --git a/nscd/connections.c b/nscd/connections.c
index 1e3cd7557f..0426e6346f 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1556,18 +1556,24 @@ main_loop_poll (void)
 	      /* We have a new incoming connection.  Accept the connection.  */
 	      int fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL));
 
-	      /* use the descriptor if we have not reached the limit.  */
-	      if (fd >= 0 && firstfree < nconns)
+	      /* Use the descriptor if we have not reached the limit.  */
+	      if (fd >= 0)
 		{
-		  conns[firstfree].fd = fd;
-		  conns[firstfree].events = POLLRDNORM;
-		  starttime[firstfree] = now;
-		  if (firstfree >= nused)
-		    nused = firstfree + 1;
-
-		  do
-		    ++firstfree;
-		  while (firstfree < nused && conns[firstfree].fd != -1);
+		  if (firstfree < nconns)
+		    {
+		      conns[firstfree].fd = fd;
+		      conns[firstfree].events = POLLRDNORM;
+		      starttime[firstfree] = now;
+		      if (firstfree >= nused)
+			nused = firstfree + 1;
+
+		      do
+			++firstfree;
+		      while (firstfree < nused && conns[firstfree].fd != -1);
+		    }
+		  else
+		    /* We cannot use the connection so close it.  */
+		    close (fd);
 		}
 
 	      --n;
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 2941cbdc15..917163af78 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -491,10 +491,10 @@ write_pid (const char *file)
     return -1;
 
   fprintf (fp, "%d\n", getpid ());
-  if (fflush (fp) || ferror (fp))
-    return -1;
+
+  int result = fflush (fp) || ferror (fp) ? -1 : 0;
 
   fclose (fp);
 
-  return 0;
+  return result;
 }
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 8025168a5e..fd749446be 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -176,35 +176,40 @@ get_mapping (request_type type, const char *key,
   struct mapped_database *result = NO_MAPPING;
 #ifdef SCM_RIGHTS
   const size_t keylen = strlen (key) + 1;
-  char resdata[keylen];
   int saved_errno = errno;
 
   int mapfd = -1;
 
   /* Send the request.  */
-  struct iovec iov[2];
-  request_header req;
+  struct
+  {
+    request_header req;
+    char key[keylen];
+  } reqdata;
 
   int sock = open_socket ();
   if (sock < 0)
     goto out;
 
-  req.version = NSCD_VERSION;
-  req.type = type;
-  req.key_len = keylen;
-
-  iov[0].iov_base = &req;
-  iov[0].iov_len = sizeof (req);
-  iov[1].iov_base = (void *) key;
-  iov[1].iov_len = keylen;
+  reqdata.req.version = NSCD_VERSION;
+  reqdata.req.type = type;
+  reqdata.req.key_len = keylen;
+  memcpy (reqdata.key, key, keylen);
 
-  if (__builtin_expect (TEMP_FAILURE_RETRY (__writev (sock, iov, 2))
-			!= iov[0].iov_len + iov[1].iov_len, 0))
+# ifndef MSG_NOSIGNAL
+#  define MSG_NOSIGNAL 0
+# endif
+  if (__builtin_expect (TEMP_FAILURE_RETRY (__send (sock, &reqdata,
+						    sizeof (reqdata),
+						    MSG_NOSIGNAL))
+			!= sizeof (reqdata), 0))
     /* We cannot even write the request.  */
     goto out_close2;
 
   /* Room for the data sent along with the file descriptor.  We expect
      the key name back.  */
+# define resdata reqdata.key
+  struct iovec iov[1];
   iov[0].iov_base = resdata;
   iov[0].iov_len = keylen;
 
@@ -231,11 +236,7 @@ get_mapping (request_type type, const char *key,
   if (wait_on_socket (sock) <= 0)
     goto out_close2;
 
-# ifndef MSG_NOSIGNAL
-#  define MSG_NOSIGNAL 0
-# endif
-  if (__builtin_expect (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg,
-						       MSG_NOSIGNAL))
+  if (__builtin_expect (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, 0))
 			!= keylen, 0))
     goto out_close2;
 
diff --git a/nss/nss_files/files-key.c b/nss/nss_files/files-key.c
index f00fc1cfe9..5c7ad0999a 100644
--- a/nss/nss_files/files-key.c
+++ b/nss/nss_files/files-key.c
@@ -1,5 +1,5 @@
 /* Public key file parser in nss_files module.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -78,6 +78,7 @@ search (const char *netname, char *result, int *errnop, int secret)
 	p = __strtok_r (NULL, ":\n", &save_ptr);
       if (p == NULL)  /* malformed line? */
 	continue;
+      fclose (stream);
       strcpy (result, p);
       return NSS_STATUS_SUCCESS;
     }
diff --git a/posix/Makefile b/posix/Makefile
index a0c7b94b02..57f2f94d59 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -88,7 +88,7 @@ tests		:= tstgetopt testfnm runtests runptests	     \
 		   tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
 		   tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
 		   tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
-		   tst-execvp3 tst-execvp4 tst-rfc3484
+		   tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2
 xtests		:= bug-ga2
 ifeq (yes,$(build-shared))
 test-srcs	:= globtest
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
index b72b7c758a..d461108e53 100644
--- a/posix/bits/unistd.h
+++ b/posix/bits/unistd.h
@@ -1,5 +1,5 @@
 /* Checking macros for unistd functions.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -80,16 +80,16 @@ pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
 #endif
 
 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
-extern int __readlink_chk (__const char *__restrict __path,
-			   char *__restrict __buf, size_t __len,
-			   size_t __buflen)
+extern ssize_t __readlink_chk (__const char *__restrict __path,
+			       char *__restrict __buf, size_t __len,
+			       size_t __buflen)
      __THROW __nonnull ((1, 2)) __wur;
-extern int __REDIRECT_NTH (__readlink_alias,
-			   (__const char *__restrict __path,
-			    char *__restrict __buf, size_t __len), readlink)
+extern ssize_t __REDIRECT_NTH (__readlink_alias,
+			       (__const char *__restrict __path,
+				char *__restrict __buf, size_t __len), readlink)
      __nonnull ((1, 2)) __wur;
 
-extern __always_inline __nonnull ((1, 2)) __wur int
+extern __always_inline __nonnull ((1, 2)) __wur ssize_t
 __NTH (readlink (__const char *__restrict __path, char *__restrict __buf,
 		 size_t __len))
 {
diff --git a/posix/regex.h b/posix/regex.h
index f6c145d209..d787b9bff9 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -1,6 +1,6 @@
 /* Definitions for data structures and routines for the regular
    expression library.
-   Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005
+   Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -29,15 +29,6 @@
 extern "C" {
 #endif
 
-/* POSIX says that <sys/types.h> must be included (by the caller) before
-   <regex.h>.  */
-
-#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
-   should be there.  */
-# include <stddef.h>
-#endif
-
 /* The following two types have to be signed and unsigned integer type
    wide enough to hold a value of a pointer.  For most ANSI compilers
    ptrdiff_t and size_t should be likely OK.  Still size of these two
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
new file mode 100644
index 0000000000..b3987c8cd5
--- /dev/null
+++ b/posix/tst-rfc3484-2.c
@@ -0,0 +1,128 @@
+#include <stdbool.h>
+#include <stdio.h>
+
+/* Internal definitions used in the libc code.  */
+#define __getservbyname_r getservbyname_r
+#define __socket socket
+#define __getsockname getsockname
+#define __inet_aton inet_aton
+#define __gethostbyaddr_r gethostbyaddr_r
+#define __gethostbyname2_r gethostbyname2_r
+
+void
+attribute_hidden
+__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen)
+{
+  *p1 = *p2 = true;
+  *in6ai = NULL;
+  *in6ailen = 0;
+}
+int
+__idna_to_ascii_lz (const char *input, char **output, int flags)
+{
+  return 0;
+}
+int
+__idna_to_unicode_lzlz (const char *input, char **output, int flags)
+{
+  return 0;
+}
+
+#include "../sysdeps/posix/getaddrinfo.c"
+
+service_user *__nss_hosts_database attribute_hidden;
+
+
+/* This is the beginning of the real test code.  The above defines
+   (among other things) the function rfc3484_sort.  */
+
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define h(n) n
+#else
+# define h(n) __bswap_constant_32 (n)
+#endif
+
+
+static int
+do_test (void)
+{
+  struct sockaddr_in so1;
+  so1.sin_family = AF_INET;
+  so1.sin_addr.s_addr = h (0xc0a85f19);
+
+  struct sockaddr_in sa1;
+  sa1.sin_family = AF_INET;
+  sa1.sin_addr.s_addr = h (0xe0a85f19);
+
+  struct addrinfo ai1;
+  ai1.ai_family = AF_INET;
+  ai1.ai_addr = (struct sockaddr *) &sa1;
+
+  struct sockaddr_in6 so2;
+  so2.sin6_family = AF_INET6;
+  so2.sin6_addr.s6_addr32[0] = h (0xfec01234);
+  so2.sin6_addr.s6_addr32[1] = 1;
+  so2.sin6_addr.s6_addr32[2] = 1;
+  so2.sin6_addr.s6_addr32[3] = 1;
+
+  struct sockaddr_in6 sa2;
+  sa2.sin6_family = AF_INET6;
+  sa2.sin6_addr.s6_addr32[0] = h (0x07d10001);
+  sa2.sin6_addr.s6_addr32[1] = 1;
+  sa2.sin6_addr.s6_addr32[2] = 1;
+  sa2.sin6_addr.s6_addr32[3] = 1;
+
+  struct addrinfo ai2;
+  ai2.ai_family = AF_INET6;
+  ai2.ai_addr = (struct sockaddr *) &sa2;
+
+
+  struct sort_result results[2];
+
+  results[0].dest_addr = &ai1;
+  results[0].got_source_addr = true;
+  results[0].source_addr_len = sizeof (so1);
+  memcpy (&results[0].source_addr, &so1, sizeof (so1));
+
+  results[1].dest_addr = &ai2;
+  results[1].got_source_addr = true;
+  results[1].source_addr_len = sizeof (so2);
+  memcpy (&results[1].source_addr, &so2, sizeof (so2));
+
+
+  qsort (results, 2, sizeof (results[0]), rfc3484_sort);
+
+  int result = 0;
+  if (results[0].dest_addr->ai_family == AF_INET6)
+    {
+      puts ("wrong order in first test");
+      result |= 1;
+    }
+
+
+  /* And again, this time with the reverse starting order.  */
+  results[1].dest_addr = &ai1;
+  results[1].got_source_addr = true;
+  results[1].source_addr_len = sizeof (so1);
+  memcpy (&results[1].source_addr, &so1, sizeof (so1));
+
+  results[0].dest_addr = &ai2;
+  results[0].got_source_addr = true;
+  results[0].source_addr_len = sizeof (so2);
+  memcpy (&results[0].source_addr, &so2, sizeof (so2));
+
+
+  qsort (results, 2, sizeof (results[0]), rfc3484_sort);
+
+  if (results[0].dest_addr->ai_family == AF_INET6)
+    {
+      puts ("wrong order in second test");
+      result |= 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
index 378e43a011..abfb76d543 100644
--- a/posix/tst-rfc3484.c
+++ b/posix/tst-rfc3484.c
@@ -11,9 +11,11 @@
 
 void
 attribute_hidden
-__check_pf (bool *p1, bool *p2)
+__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen)
 {
   *p1 = *p2 = true;
+  *in6ai = NULL;
+  *in6ailen = 0;
 }
 int
 __idna_to_ascii_lz (const char *input, char **output, int flags)
diff --git a/posix/unistd.h b/posix/unistd.h
index c8e8a0594a..c7a52722ca 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -770,8 +770,9 @@ extern int symlink (__const char *__from, __const char *__to)
 /* Read the contents of the symbolic link PATH into no more than
    LEN bytes of BUF.  The contents are not null-terminated.
    Returns the number of characters read, or -1 for errors.  */
-extern int readlink (__const char *__restrict __path, char *__restrict __buf,
-		     size_t __len) __THROW __nonnull ((1, 2)) __wur;
+extern ssize_t readlink (__const char *__restrict __path,
+			 char *__restrict __buf, size_t __len)
+     __THROW __nonnull ((1, 2)) __wur;
 #endif /* Use BSD.  */
 
 #ifdef __USE_ATFILE
@@ -780,8 +781,8 @@ extern int symlinkat (__const char *__from, int __tofd,
 		      __const char *__to) __THROW __nonnull ((1, 3)) __wur;
 
 /* Like readlink but a relative PATH is interpreted relative to FD.  */
-extern int readlinkat (int __fd, __const char *__restrict __path,
-		       char *__restrict __buf, size_t __len)
+extern ssize_t readlinkat (int __fd, __const char *__restrict __path,
+			   char *__restrict __buf, size_t __len)
      __THROW __nonnull ((2, 3)) __wur;
 #endif
 
diff --git a/signal/Makefile b/signal/Makefile
index b5c18fef04..fa8d098da0 100644
--- a/signal/Makefile
+++ b/signal/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,2003
-#	Free Software Foundation, Inc.
+# Copyright (C) 1991-1998,2003,2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -38,7 +37,7 @@ routines	:= signal raise killpg \
 		   allocrtsig sigtimedwait sigwaitinfo sigqueue \
 		   sighold sigrelse sigignore sigset
 
-tests		:= tst-signal tst-sigset tst-sigsimple tst-raise
+tests		:= tst-signal tst-sigset tst-sigsimple tst-raise tst-sigset2
 
 distribute	:= sigsetops.h testrtsig.h sigset-cvt-mask.h
 
diff --git a/signal/tst-sigset2.c b/signal/tst-sigset2.c
new file mode 100644
index 0000000000..f653323321
--- /dev/null
+++ b/signal/tst-sigset2.c
@@ -0,0 +1,184 @@
+/* sigset_SIG_HOLD_bug.c [BZ #1951] */
+#include <errno.h>
+#include <error.h>
+#include <inttypes.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#define TEST_SIG SIGINT
+
+
+/* Print mask of blocked signals for this process */
+static void
+printSigMask (const char *msg)
+{
+  sigset_t currMask;
+  int sig;
+  int cnt;
+
+  if (msg != NULL)
+    printf ("%s", msg);
+
+  if (sigprocmask (SIG_BLOCK, NULL, &currMask) == -1)
+    error (1, errno, "sigaction");
+
+  cnt = 0;
+  for (sig = 1; sig < NSIG; sig++)
+    {
+      if (sigismember (&currMask, sig))
+	{
+	  cnt++;
+	  printf ("\t\t%d (%s)\n", sig, strsignal (sig));
+        }
+    }
+
+  if (cnt == 0)
+    printf ("\t\t<empty signal set>\n");
+} /* printSigMask */
+
+static void
+handler (int sig)
+{
+  printf ("Caught signal %d\n", sig);
+  printSigMask ("Signal mask in handler\n");
+  printf ("Handler returning\n");
+  _exit (1);
+} /* handler */
+
+static void
+printDisposition (sighandler_t disp)
+{
+  if (disp == SIG_HOLD)
+    printf ("SIG_HOLD");
+  else if (disp == SIG_DFL)
+    printf ("SIG_DFL");
+  else if (disp == SIG_IGN)
+    printf ("SIG_IGN");
+  else
+    printf ("handled at %" PRIxPTR, (uintptr_t) disp);
+} /* printDisposition */
+
+static int
+returnTest1 (void)
+{
+  sighandler_t prev;
+
+  printf ("===== TEST 1 =====\n");
+  printf ("Blocking signal with sighold()\n");
+  if (sighold (TEST_SIG) == -1)
+    error (1, errno, "sighold");
+  printSigMask ("Signal mask after sighold()\n");
+
+  printf ("About to use sigset() to establish handler\n");
+  prev = sigset (TEST_SIG, handler);
+  if (prev == SIG_ERR)
+    error(1, errno, "sigset");
+
+  printf ("Previous disposition: ");
+  printDisposition (prev);
+  printf (" (should be SIG_HOLD)\n");
+  if (prev != SIG_HOLD)
+    {
+      printf("TEST FAILED!!!\n");
+      return 1;
+    }
+  return 0;
+} /* returnTest1 */
+
+static int
+returnTest2 (void)
+{
+  sighandler_t prev;
+
+  printf ("\n===== TEST 2 =====\n");
+
+  printf ("About to use sigset() to set SIG_HOLD\n");
+  prev = sigset (TEST_SIG, SIG_HOLD);
+  if (prev == SIG_ERR)
+    error (1, errno, "sigset");
+
+  printf ("Previous disposition: ");
+  printDisposition (prev);
+  printf (" (should be SIG_DFL)\n");
+  if (prev != SIG_DFL)
+    {
+      printf("TEST FAILED!!!\n");
+      return 1;
+    }
+  return 0;
+} /* returnTest2 */
+
+static int
+returnTest3 (void)
+{
+  sighandler_t prev;
+
+  printf ("\n===== TEST 3 =====\n");
+
+  printf ("About to use sigset() to set SIG_HOLD\n");
+  prev = sigset (TEST_SIG, SIG_HOLD);
+  if (prev == SIG_ERR)
+    error (1, errno, "sigset");
+
+  printf ("About to use sigset() to set SIG_HOLD (again)\n");
+  prev = sigset (TEST_SIG, SIG_HOLD);
+  if (prev == SIG_ERR)
+    error (1, errno, "sigset");
+
+  printf ("Previous disposition: ");
+  printDisposition (prev);
+  printf (" (should be SIG_HOLD)\n");
+  if (prev != SIG_HOLD)
+    {
+      printf("TEST FAILED!!!\n");
+      return 1;
+    }
+  return 0;
+} /* returnTest3 */
+
+int
+main (int argc, char *argv[])
+{
+  pid_t childPid;
+
+  childPid = fork();
+  if (childPid == -1)
+    error (1, errno, "fork");
+
+  if (childPid == 0)
+    exit (returnTest1 ());
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (childPid, &status, 0)) != childPid)
+    error (1, errno, "waitpid");
+  int result = !WIFEXITED (status) || WEXITSTATUS (status) != 0;
+
+  childPid = fork();
+  if (childPid == -1)
+    error (1, errno, "fork");
+
+  if (childPid == 0)
+    exit (returnTest2 ());
+
+  if (TEMP_FAILURE_RETRY (waitpid (childPid, &status, 0)) != childPid)
+    error (1, errno, "waitpid");
+  result |= !WIFEXITED (status) || WEXITSTATUS (status) != 0;
+
+  childPid = fork();
+  if (childPid == -1)
+    error (1, errno, "fork");
+
+  if (childPid == 0)
+    exit (returnTest3 ());
+
+  if (TEMP_FAILURE_RETRY (waitpid (childPid, &status, 0)) != childPid)
+    error (1, errno, "waitpid");
+  result |= !WIFEXITED (status) || WEXITSTATUS (status) != 0;
+
+  return result;
+} /* main */
diff --git a/soft-fp/adddf3.c b/soft-fp/adddf3.c
index 269ef664c7..24c03db0a6 100644
--- a/soft-fp/adddf3.c
+++ b/soft-fp/adddf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/addsf3.c b/soft-fp/addsf3.c
index cfd9526ea6..b86991ee56 100644
--- a/soft-fp/addsf3.c
+++ b/soft-fp/addsf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/addtf3.c b/soft-fp/addtf3.c
index f889a189b6..49b67f0ba9 100644
--- a/soft-fp/addtf3.c
+++ b/soft-fp/addtf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/divdf3.c b/soft-fp/divdf3.c
index b45a91ce0c..c3bb0d247c 100644
--- a/soft-fp/divdf3.c
+++ b/soft-fp/divdf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/divsf3.c b/soft-fp/divsf3.c
index d62c7c02b7..176bb3c2cb 100644
--- a/soft-fp/divsf3.c
+++ b/soft-fp/divsf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/divtf3.c b/soft-fp/divtf3.c
index 842aa8116e..916fbfe974 100644
--- a/soft-fp/divtf3.c
+++ b/soft-fp/divtf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/double.h b/soft-fp/double.h
index 86fd8ada86..c8f4420af8 100644
--- a/soft-fp/double.h
+++ b/soft-fp/double.h
@@ -12,6 +12,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -19,8 +28,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel kid.  Go buy yourself a real computer."
diff --git a/soft-fp/eqdf2.c b/soft-fp/eqdf2.c
index d1eb97222f..efa769e986 100644
--- a/soft-fp/eqdf2.c
+++ b/soft-fp/eqdf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/eqsf2.c b/soft-fp/eqsf2.c
index 371465f74d..7e01c01d2f 100644
--- a/soft-fp/eqsf2.c
+++ b/soft-fp/eqsf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/eqtf2.c b/soft-fp/eqtf2.c
index 59479b47a0..fd6ffd1ebe 100644
--- a/soft-fp/eqtf2.c
+++ b/soft-fp/eqtf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/extenddftf2.c b/soft-fp/extenddftf2.c
index e25cc5c822..4101639a94 100644
--- a/soft-fp/extenddftf2.c
+++ b/soft-fp/extenddftf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/extended.h b/soft-fp/extended.h
index 0f2060e970..bbf39429e7 100644
--- a/soft-fp/extended.h
+++ b/soft-fp/extended.h
@@ -9,6 +9,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -16,8 +25,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel, kid. Go buy yourself a real computer."
diff --git a/soft-fp/extendsfdf2.c b/soft-fp/extendsfdf2.c
index 220caf930d..fba22d5a19 100644
--- a/soft-fp/extendsfdf2.c
+++ b/soft-fp/extendsfdf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/extendsftf2.c b/soft-fp/extendsftf2.c
index 412d2e877c..c43cf1edee 100644
--- a/soft-fp/extendsftf2.c
+++ b/soft-fp/extendsftf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/fixdfdi.c b/soft-fp/fixdfdi.c
index 537de101c6..fdfe35af51 100644
--- a/soft-fp/fixdfdi.c
+++ b/soft-fp/fixdfdi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/fixdfsi.c b/soft-fp/fixdfsi.c
index 0607005108..a05f3e39a5 100644
--- a/soft-fp/fixdfsi.c
+++ b/soft-fp/fixdfsi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/fixsfdi.c b/soft-fp/fixsfdi.c
index d9ef9e843b..384d9bdd53 100644
--- a/soft-fp/fixsfdi.c
+++ b/soft-fp/fixsfdi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/fixsfsi.c b/soft-fp/fixsfsi.c
index 916b079387..1d40ed05df 100644
--- a/soft-fp/fixsfsi.c
+++ b/soft-fp/fixsfsi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/fixtfdi.c b/soft-fp/fixtfdi.c
index 73a1cc7cbf..ea10ce2dd3 100644
--- a/soft-fp/fixtfdi.c
+++ b/soft-fp/fixtfdi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/fixtfsi.c b/soft-fp/fixtfsi.c
index 78bad0ee39..eb71038bc3 100644
--- a/soft-fp/fixtfsi.c
+++ b/soft-fp/fixtfsi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/fixunsdfdi.c b/soft-fp/fixunsdfdi.c
index b350d95272..d85198f185 100644
--- a/soft-fp/fixunsdfdi.c
+++ b/soft-fp/fixunsdfdi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/fixunsdfsi.c b/soft-fp/fixunsdfsi.c
index c363e5fbce..492ffdea68 100644
--- a/soft-fp/fixunsdfsi.c
+++ b/soft-fp/fixunsdfsi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/fixunssfdi.c b/soft-fp/fixunssfdi.c
index 6a43cb88ef..5484153837 100644
--- a/soft-fp/fixunssfdi.c
+++ b/soft-fp/fixunssfdi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/fixunssfsi.c b/soft-fp/fixunssfsi.c
index 3ddcee55de..ac9d4b9654 100644
--- a/soft-fp/fixunssfsi.c
+++ b/soft-fp/fixunssfsi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/fixunstfdi.c b/soft-fp/fixunstfdi.c
index 0bf5327d1c..86f1fc8562 100644
--- a/soft-fp/fixunstfdi.c
+++ b/soft-fp/fixunstfdi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/fixunstfsi.c b/soft-fp/fixunstfsi.c
index 387b9c615b..e0335da479 100644
--- a/soft-fp/fixunstfsi.c
+++ b/soft-fp/fixunstfsi.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/floatdidf.c b/soft-fp/floatdidf.c
index 2c6800010f..21e9fb1899 100644
--- a/soft-fp/floatdidf.c
+++ b/soft-fp/floatdidf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/floatdisf.c b/soft-fp/floatdisf.c
index 36f05ee409..ee57915c3b 100644
--- a/soft-fp/floatdisf.c
+++ b/soft-fp/floatdisf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/floatditf.c b/soft-fp/floatditf.c
index 03487adfcb..564800bc05 100644
--- a/soft-fp/floatditf.c
+++ b/soft-fp/floatditf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/floatsidf.c b/soft-fp/floatsidf.c
index d11ddcc9f1..b6d5f8d1d2 100644
--- a/soft-fp/floatsidf.c
+++ b/soft-fp/floatsidf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/floatsisf.c b/soft-fp/floatsisf.c
index 64006e691b..76217fe347 100644
--- a/soft-fp/floatsisf.c
+++ b/soft-fp/floatsisf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/floatsitf.c b/soft-fp/floatsitf.c
index 5a64c70bc2..8c3d9cc619 100644
--- a/soft-fp/floatsitf.c
+++ b/soft-fp/floatsitf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/floatundidf.c b/soft-fp/floatundidf.c
index dcec2f8360..2169a3f198 100644
--- a/soft-fp/floatundidf.c
+++ b/soft-fp/floatundidf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/floatundisf.c b/soft-fp/floatundisf.c
index a2437e4071..5f08764dc5 100644
--- a/soft-fp/floatundisf.c
+++ b/soft-fp/floatundisf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/floatunditf.c b/soft-fp/floatunditf.c
index f0fd3af92d..ab357f051c 100644
--- a/soft-fp/floatunditf.c
+++ b/soft-fp/floatunditf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/floatunsidf.c b/soft-fp/floatunsidf.c
index b43ed35cd7..97b488ab68 100644
--- a/soft-fp/floatunsidf.c
+++ b/soft-fp/floatunsidf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/floatunsisf.c b/soft-fp/floatunsisf.c
index 16fbf1dddb..2ec16ba7b7 100644
--- a/soft-fp/floatunsisf.c
+++ b/soft-fp/floatunsisf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/floatunsitf.c b/soft-fp/floatunsitf.c
index afc3b7862b..c993716e54 100644
--- a/soft-fp/floatunsitf.c
+++ b/soft-fp/floatunsitf.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/gedf2.c b/soft-fp/gedf2.c
index b3af2f16d8..e0dc8620ee 100644
--- a/soft-fp/gedf2.c
+++ b/soft-fp/gedf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/gesf2.c b/soft-fp/gesf2.c
index d1cdbec7d3..d1f3ba2f9f 100644
--- a/soft-fp/gesf2.c
+++ b/soft-fp/gesf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/getf2.c b/soft-fp/getf2.c
index 51aa7de370..82ff283d0d 100644
--- a/soft-fp/getf2.c
+++ b/soft-fp/getf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/ledf2.c b/soft-fp/ledf2.c
index f5efaaabd8..528a9819ce 100644
--- a/soft-fp/ledf2.c
+++ b/soft-fp/ledf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/lesf2.c b/soft-fp/lesf2.c
index 86e0c87a39..c564bd9539 100644
--- a/soft-fp/lesf2.c
+++ b/soft-fp/lesf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/letf2.c b/soft-fp/letf2.c
index 339ee0381f..35e03aaacf 100644
--- a/soft-fp/letf2.c
+++ b/soft-fp/letf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/muldf3.c b/soft-fp/muldf3.c
index e6f8a0f108..7eb2015ae5 100644
--- a/soft-fp/muldf3.c
+++ b/soft-fp/muldf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/mulsf3.c b/soft-fp/mulsf3.c
index b493df8609..5df4406872 100644
--- a/soft-fp/mulsf3.c
+++ b/soft-fp/mulsf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/multf3.c b/soft-fp/multf3.c
index 067ff1a3f7..0abab6ddc3 100644
--- a/soft-fp/multf3.c
+++ b/soft-fp/multf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/negdf2.c b/soft-fp/negdf2.c
index cc3ce78f56..54869e9a68 100644
--- a/soft-fp/negdf2.c
+++ b/soft-fp/negdf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/negsf2.c b/soft-fp/negsf2.c
index 48ac33b914..bf5db7a452 100644
--- a/soft-fp/negsf2.c
+++ b/soft-fp/negsf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/negtf2.c b/soft-fp/negtf2.c
index 38fbe97d58..5524c82df1 100644
--- a/soft-fp/negtf2.c
+++ b/soft-fp/negtf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/op-1.h b/soft-fp/op-1.h
index 9f58ba6a08..35cd0ba7bb 100644
--- a/soft-fp/op-1.h
+++ b/soft-fp/op-1.h
@@ -12,6 +12,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -19,8 +28,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #define _FP_FRAC_DECL_1(X)	_FP_W_TYPE X##_f
 #define _FP_FRAC_COPY_1(D,S)	(D##_f = S##_f)
diff --git a/soft-fp/op-2.h b/soft-fp/op-2.h
index d8b89ff843..5c9bce4c17 100644
--- a/soft-fp/op-2.h
+++ b/soft-fp/op-2.h
@@ -12,6 +12,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -19,8 +28,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #define _FP_FRAC_DECL_2(X)	_FP_W_TYPE X##_f0, X##_f1
 #define _FP_FRAC_COPY_2(D,S)	(D##_f0 = S##_f0, D##_f1 = S##_f1)
diff --git a/soft-fp/op-4.h b/soft-fp/op-4.h
index c0ffaafff6..34f5098e8c 100644
--- a/soft-fp/op-4.h
+++ b/soft-fp/op-4.h
@@ -12,6 +12,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -19,8 +28,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #define _FP_FRAC_DECL_4(X)	_FP_W_TYPE X##_f[4]
 #define _FP_FRAC_COPY_4(D,S)			\
diff --git a/soft-fp/op-8.h b/soft-fp/op-8.h
index 01d92357dd..e0612a5e62 100644
--- a/soft-fp/op-8.h
+++ b/soft-fp/op-8.h
@@ -11,6 +11,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -18,8 +27,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 /* We need just a few things from here for op-4, if we ever need some
    other macros, they can be added. */
diff --git a/soft-fp/op-common.h b/soft-fp/op-common.h
index 957f71dacd..4ec7fade48 100644
--- a/soft-fp/op-common.h
+++ b/soft-fp/op-common.h
@@ -11,6 +11,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -18,8 +27,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #define _FP_DECL(wc, X)						\
   _FP_I_TYPE X##_c __attribute__((unused)), X##_s, X##_e;	\
diff --git a/soft-fp/quad.h b/soft-fp/quad.h
index 578f17e436..d7840ff066 100644
--- a/soft-fp/quad.h
+++ b/soft-fp/quad.h
@@ -12,6 +12,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -19,8 +28,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel, kid. Go buy yourself a real computer."
diff --git a/soft-fp/single.h b/soft-fp/single.h
index ffb31786af..9c3734adf4 100644
--- a/soft-fp/single.h
+++ b/soft-fp/single.h
@@ -12,6 +12,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -19,8 +28,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #if _FP_W_TYPE_SIZE < 32
 #error "Here's a nickel kid.  Go buy yourself a real computer."
diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h
index 4d4e5d504c..dbf080e7f4 100644
--- a/soft-fp/soft-fp.h
+++ b/soft-fp/soft-fp.h
@@ -12,6 +12,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -19,8 +28,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #ifndef SOFT_FP_H
 #define SOFT_FP_H
diff --git a/soft-fp/sqrtdf2.c b/soft-fp/sqrtdf2.c
index b52cafd04d..90601a3748 100644
--- a/soft-fp/sqrtdf2.c
+++ b/soft-fp/sqrtdf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/sqrtsf2.c b/soft-fp/sqrtsf2.c
index 436e8cedad..9102b8c3a7 100644
--- a/soft-fp/sqrtsf2.c
+++ b/soft-fp/sqrtsf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/sqrttf2.c b/soft-fp/sqrttf2.c
index ac2ad6fc5f..5026ae19ad 100644
--- a/soft-fp/sqrttf2.c
+++ b/soft-fp/sqrttf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/subdf3.c b/soft-fp/subdf3.c
index 81a2585d62..3978b52998 100644
--- a/soft-fp/subdf3.c
+++ b/soft-fp/subdf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/subsf3.c b/soft-fp/subsf3.c
index 843fb5055d..f1cbdd1ff1 100644
--- a/soft-fp/subsf3.c
+++ b/soft-fp/subsf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/subtf3.c b/soft-fp/subtf3.c
index a8e2eead5f..7ba4c8c5ea 100644
--- a/soft-fp/subtf3.c
+++ b/soft-fp/subtf3.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/soft-fp/truncdfsf2.c b/soft-fp/truncdfsf2.c
index 0e802d9dfd..bd953912e9 100644
--- a/soft-fp/truncdfsf2.c
+++ b/soft-fp/truncdfsf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/trunctfdf2.c b/soft-fp/trunctfdf2.c
index e88d476f13..c3827b08ab 100644
--- a/soft-fp/trunctfdf2.c
+++ b/soft-fp/trunctfdf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/trunctfsf2.c b/soft-fp/trunctfsf2.c
index 0601cf01fd..676c937e20 100644
--- a/soft-fp/trunctfsf2.c
+++ b/soft-fp/trunctfsf2.c
@@ -10,6 +10,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -17,8 +26,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/unorddf2.c b/soft-fp/unorddf2.c
index c44b61d131..c83a563275 100644
--- a/soft-fp/unorddf2.c
+++ b/soft-fp/unorddf2.c
@@ -9,6 +9,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -16,8 +25,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/soft-fp/unordsf2.c b/soft-fp/unordsf2.c
index 4924ddcc1e..8de7563566 100644
--- a/soft-fp/unordsf2.c
+++ b/soft-fp/unordsf2.c
@@ -9,6 +9,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -16,8 +25,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/soft-fp/unordtf2.c b/soft-fp/unordtf2.c
index f0e43c1dee..134b1d09b8 100644
--- a/soft-fp/unordtf2.c
+++ b/soft-fp/unordtf2.c
@@ -9,6 +9,15 @@
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file into
+   combinations with other programs, and to distribute those
+   combinations without any restriction coming from the use of this
+   file.  (The Lesser General Public License restrictions do apply in
+   other respects; for example, they cover modification of the file,
+   and distribution when not linked into a combine executable.)
+
    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
@@ -16,8 +25,8 @@
 
    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.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "soft-fp.h"
 #include "quad.h"
diff --git a/string/Makefile b/string/Makefile
index 8f9b2ac371..7c11c1ac22 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -64,10 +64,12 @@ inl-tester-ENV = LANGUAGE=C
 noinl-tester-ENV = LANGUAGE=C
 tst-strxfrm-ENV = LOCPATH=$(common-objpfx)localedata
 bug-strcoll1-ENV = LOCPATH=$(common-objpfx)localedata
+CFLAGS-inl-tester.c = -fno-builtin
 CFLAGS-noinl-tester.c = -fno-builtin
 CFLAGS-tst-strlen.c = -fno-builtin
 CFLAGS-stratcliff.c = -fno-builtin
 CFLAGS-test-ffs.c = -fno-builtin
+CFLAGS-tst-inlcall.c = -fno-builtin
 
 ifeq ($(cross-compiling),no)
 tests: $(objpfx)tst-svc.out
diff --git a/sunrpc/rpc_cout.c b/sunrpc/rpc_cout.c
index dfc57fd277..21056e84a6 100644
--- a/sunrpc/rpc_cout.c
+++ b/sunrpc/rpc_cout.c
@@ -551,6 +551,7 @@ inline_struct (definition *def, int flag)
 	    }
 	  size = 0;
 	  i = 0;
+	  free (sizestr);
 	  sizestr = NULL;
 	  print_stat (indent + 1, &dl->decl);
 	}
diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c
index 2679720a7f..954657a7e4 100644
--- a/sunrpc/rpc_main.c
+++ b/sunrpc/rpc_main.c
@@ -531,7 +531,7 @@ generate_guard (const char *pathname)
 
   filename = strrchr (pathname, '/');	/* find last component */
   filename = ((filename == NULL) ? pathname : filename + 1);
-  guard = strdup (filename);
+  guard = extendfile (filename, "_H_RPCGEN");
   /* convert to upper case */
   tmp = guard;
   while (*tmp)
@@ -541,7 +541,6 @@ generate_guard (const char *pathname)
       tmp++;
     }
 
-  guard = extendfile (guard, "_H_RPCGEN");
   return guard;
 }
 
@@ -661,6 +660,7 @@ h_output (const char *infile, const char *define, int extend,
     }
 
   fprintf (fout, "\n#endif /* !_%s */\n", guard);
+  free (guard);
   close_input ();
   close_output (outfilename);
 }
@@ -946,6 +946,8 @@ clnt_output (const char *infile, const char *define, int extend,
   close_output (outfilename);
 }
 
+static const char space[] = " ";
+
 static char *
 file_name (const char *file, const char *ext)
 {
@@ -954,16 +956,17 @@ file_name (const char *file, const char *ext)
 
   if (access (temp, F_OK) != -1)
     return (temp);
-  else
-    return ((char *) " ");
+
+  free (temp);
+  return (char *) space;
 }
 
 static void
 mkfile_output (struct commandline *cmd)
 {
   char *mkfilename;
-  const char *clientname, *clntname, *xdrname, *hdrname;
-  const char *servername, *svcname, *servprogname, *clntprogname;
+  char *clientname, *clntname, *xdrname, *hdrname;
+  char *servername, *svcname, *servprogname, *clntprogname;
 
   svcname = file_name (cmd->infile, "_svc.c");
   clntname = file_name (cmd->infile, "_clnt.c");
@@ -977,8 +980,8 @@ mkfile_output (struct commandline *cmd)
     }
   else
     {
-      servername = " ";
-      clientname = " ";
+      servername = (char *) space;
+      clientname = (char *) space;
     }
   servprogname = extendfile (cmd->infile, "_server");
   clntprogname = extendfile (cmd->infile, "_client");
@@ -988,6 +991,8 @@ mkfile_output (struct commandline *cmd)
       char *cp, *temp;
 
       mkfilename = alloc (strlen ("Makefile.") + strlen (cmd->infile) + 1);
+      if (mkfilename == NULL)
+	abort ();
       temp = rindex (cmd->infile, '.');
       cp = stpcpy (mkfilename, "Makefile.");
       strncpy (cp, cmd->infile, (temp - cmd->infile));
@@ -1046,6 +1051,23 @@ $(LDLIBS) \n\n");
   f_print (fout, "clean:\n\t $(RM) core $(TARGETS) $(OBJECTS_CLNT) \
 $(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n");
   close_output (mkfilename);
+
+  free (clntprogname);
+  free (servprogname);
+  if (servername != space)
+    free (servername);
+  if (clientname != space)
+    free (clientname);
+  if (mkfilename != (char *) cmd->outfile)
+    free (mkfilename);
+  if (svcname != space)
+    free (svcname);
+  if (clntname != space)
+    free (clntname);
+  if (xdrname != space)
+    free (xdrname);
+  if (hdrname != space)
+    free (hdrname);
 }
 
 /*
diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c
index 2a29878d6a..f66538701f 100644
--- a/sunrpc/rpc_parse.c
+++ b/sunrpc/rpc_parse.c
@@ -91,6 +91,7 @@ get_definition (void)
       def_const (defp);
       break;
     case TOK_EOF:
+      free (defp);
       return (NULL);
     default:
       error ("definition keyword expected");
@@ -302,7 +303,9 @@ def_union (definition *defp)
   case_list *cases;
 /*  case_list *tcase; */
   case_list **tailp;
+#if 0
   int flag;
+#endif
 
   defp->def_kind = DEF_UNION;
   scan (TOK_IDENT, &tok);
@@ -322,7 +325,9 @@ def_union (definition *defp)
       cases->case_name = tok.str;
       scan (TOK_COLON, &tok);
       /* now peek at next token */
+#if 0
       flag = 0;
+#endif
       if (peekscan (TOK_CASE, &tok))
 	{
 
@@ -339,6 +344,7 @@ def_union (definition *defp)
 	    }
 	  while (peekscan (TOK_CASE, &tok));
 	}
+#if 0
       else if (flag)
 	{
 
@@ -346,6 +352,7 @@ def_union (definition *defp)
 	  tailp = &cases->next;
 	  cases = ALLOC (case_list);
 	};
+#endif
 
       get_declaration (&dec, DEF_UNION);
       cases->case_decl = dec;
diff --git a/sunrpc/rpc_scan.c b/sunrpc/rpc_scan.c
index 42ab2bae8b..af90ef6973 100644
--- a/sunrpc/rpc_scan.c
+++ b/sunrpc/rpc_scan.c
@@ -535,6 +535,7 @@ docppline (const char *line, int *lineno, const char **fname)
   *p = 0;
   if (*file == 0)
     {
+      free (file);
       *fname = NULL;
     }
   else
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index c0c115abeb..67b84f184f 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -485,6 +485,7 @@ svcudp_enablecache (SVCXPRT *transp, u_long size)
   uc->uc_entries = ALLOC (cache_ptr, size * SPARSENESS);
   if (uc->uc_entries == NULL)
     {
+      mem_free (uc, sizeof (struct udp_cache));
       CACHE_PERROR (_("enablecache: could not allocate cache data"));
       return 0;
     }
@@ -492,6 +493,8 @@ svcudp_enablecache (SVCXPRT *transp, u_long size)
   uc->uc_fifo = ALLOC (cache_ptr, size);
   if (uc->uc_fifo == NULL)
     {
+      mem_free (uc->uc_entries, size * SPARSENESS);
+      mem_free (uc, sizeof (struct udp_cache));
       CACHE_PERROR (_("enablecache: could not allocate cache fifo"));
       return 0;
     }
@@ -545,6 +548,7 @@ cache_set (SVCXPRT *xprt, u_long replylen)
       newbuf = mem_alloc (su->su_iosz);
       if (newbuf == NULL)
 	{
+	  mem_free (victim, sizeof (struct cache_node));
 	  CACHE_PERROR (_("cache_set: could not allocate new rpc_buffer"));
 	  return;
 	}
diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c
index 1f03d17279..13945b9719 100644
--- a/sysdeps/generic/unwind-dw2-fde.c
+++ b/sysdeps/generic/unwind-dw2-fde.c
@@ -1,5 +1,5 @@
 /* Subroutines needed for unwinding stack frames for exception handling.  */
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006
    Free Software Foundation, Inc.
    Contributed by Jason Merrill <jason@cygnus.com>.
 
@@ -595,7 +595,7 @@ end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
 {
   fde_compare_t fde_compare;
 
-  if (accu->linear && accu->linear->count != count)
+  if (accu->linear->count != count)
     abort ();
 
   if (ob->s.b.mixed_encoding)
diff --git a/sysdeps/generic/unwind-dw2.c b/sysdeps/generic/unwind-dw2.c
index 301b53176e..5ecf2846f3 100644
--- a/sysdeps/generic/unwind-dw2.c
+++ b/sysdeps/generic/unwind-dw2.c
@@ -1,5 +1,5 @@
 /* DWARF2 exception handling and frame unwind runtime interface routines.
-   Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005
+   Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005,2006
    	Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
@@ -897,12 +897,16 @@ execute_cfa_program (const unsigned char *insn_ptr,
 	  break;
 
 	case DW_CFA_GNU_window_save:
-	  /* ??? Hardcoded for SPARC register window configuration.  */
+	  /* ??? Hardcoded for SPARC register window configuration.
+	     At least do not do anything for archs which explicitly
+	     define a lower register number.  */
+#if DWARF_FRAME_REGISTERS >= 32
 	  for (reg = 16; reg < 32; ++reg)
 	    {
 	      fs->regs.reg[reg].how = REG_SAVED_OFFSET;
 	      fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *);
 	    }
+#endif
 	  break;
 
 	case DW_CFA_GNU_args_size:
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 46c66a8f7e..843e60bba3 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -68,7 +68,7 @@ extern int __idna_to_unicode_lzlz (const char *input, char **output,
 #define GAIH_EAI        ~(GAIH_OKIFUNSPEC)
 
 #ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX  108
+# define UNIX_PATH_MAX  108
 #endif
 
 struct gaih_service
@@ -177,9 +177,9 @@ gaih_local (const char *name, const struct gaih_service *service,
       if (! tp->name[0])
 	{
 	  if (req->ai_socktype)
-	    return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);
+	    return GAIH_OKIFUNSPEC | -EAI_SOCKTYPE;
 	  else
-	    return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+	    return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 	}
     }
 
@@ -249,9 +249,10 @@ gaih_local (const char *name, const struct gaih_service *service,
 }
 #endif	/* 0 */
 
+
 static int
 gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
-	       const struct addrinfo *req, struct gaih_servtuple *st)
+		const struct addrinfo *req, struct gaih_servtuple *st)
 {
   struct servent *s;
   size_t tmpbuflen = 1024;
@@ -362,6 +363,7 @@ typedef enum nss_status (*nss_getcanonname_r)
    int *errnop, int *h_errnop);
 extern service_user *__nss_hosts_database attribute_hidden;
 
+
 static int
 gaih_inet (const char *name, const struct gaih_service *service,
 	   const struct addrinfo *req, struct addrinfo **pai,
@@ -389,9 +391,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
       if (! tp->name[0])
 	{
 	  if (req->ai_socktype)
-	    return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);
+	    return GAIH_OKIFUNSPEC | -EAI_SOCKTYPE;
 	  else
-	    return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+	    return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 	}
     }
 
@@ -399,7 +401,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
   if (service != NULL)
     {
       if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0)
-	return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+	return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 
       if (service->num < 0)
 	{
@@ -443,7 +445,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  pst = &(newp->next);
 		}
 	      if (st == (struct gaih_servtuple *) &nullserv)
-		return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+		return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 	    }
 	}
       else
@@ -538,16 +540,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  else
 	    return -EAI_ADDRFAMILY;
 
-	dupname:
 	  if (req->ai_flags & AI_CANONNAME)
-	    {
-	      canon = strdup (name);
-	      if (canon == NULL)
-		return -EAI_MEMORY;
-	    }
+	    canon = name;
 	}
-
-      if (at->family == AF_UNSPEC)
+      else if (at->family == AF_UNSPEC)
 	{
 	  char *namebuf = (char *) name;
 	  char *scope_delim = strchr (name, SCOPE_DELIMITER);
@@ -595,7 +591,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		    }
 		}
 
-	      goto dupname;
+	      if (req->ai_flags & AI_CANONNAME)
+		canon = name;
 	    }
 	}
 
@@ -689,7 +686,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		    }
 		  /* We made requests but they turned out no data.
 		     The name is known, though.  */
-		  return (GAIH_OKIFUNSPEC | -EAI_NODATA);
+		  return GAIH_OKIFUNSPEC | -EAI_NODATA;
 		}
 
 	      goto process_list;
@@ -756,7 +753,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  free (air);
 
 		  if (at->family == AF_UNSPEC)
-		    return (GAIH_OKIFUNSPEC | -EAI_NONAME);
+		    return GAIH_OKIFUNSPEC | -EAI_NONAME;
 
 		  goto process_list;
 		}
@@ -898,13 +895,13 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
 	      /* We made requests but they turned out no data.  The name
 		 is known, though.  */
-	      return (GAIH_OKIFUNSPEC | -EAI_NODATA);
+	      return GAIH_OKIFUNSPEC | -EAI_NODATA;
 	    }
 	}
 
     process_list:
       if (at->family == AF_UNSPEC)
-	return (GAIH_OKIFUNSPEC | -EAI_NONAME);
+	return GAIH_OKIFUNSPEC | -EAI_NONAME;
     }
   else
     {
@@ -1098,6 +1095,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
   return 0;
 }
 
+#if 0
 static const struct gaih gaih[] =
   {
     { PF_INET6, gaih_inet },
@@ -1107,6 +1105,7 @@ static const struct gaih gaih[] =
 #endif
     { PF_UNSPEC, NULL }
   };
+#endif
 
 struct sort_result
 {
@@ -1114,6 +1113,7 @@ struct sort_result
   struct sockaddr_storage source_addr;
   uint8_t source_addr_len;
   bool got_source_addr;
+  uint8_t source_addr_flags;
 };
 
 
@@ -1204,7 +1204,7 @@ static const struct prefixlist default_precedence[] =
       96, 20 },
     { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
 				  0x0000, 0xffff, 0x0000, 0x0000 } } },
-      96, 10 },
+      96, 100 },
     { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
 				  0x0000, 0x0000, 0x0000, 0x0000 } } },
       0, 40 }
@@ -1336,8 +1336,16 @@ rfc3484_sort (const void *p1, const void *p2)
     }
 
 
-  /* Rule 3: Avoid deprecated addresses.
-     That's something only the kernel could decide.  */
+  /* Rule 3: Avoid deprecated addresses.  */
+  if (a1->got_source_addr)
+    {
+      if (!(a1->source_addr_flags & in6ai_deprecated)
+	  && (a2->source_addr_flags & in6ai_deprecated))
+	return -1;
+      if ((a1->source_addr_flags & in6ai_deprecated)
+	  && !(a2->source_addr_flags & in6ai_deprecated))
+	return 1;
+    }
 
   /* Rule 4: Prefer home addresses.
      Another thing only the kernel can decide.  */
@@ -1372,8 +1380,18 @@ rfc3484_sort (const void *p1, const void *p2)
     return 1;
 
 
-  /* Rule 7: Prefer native transport.
-     XXX How to recognize tunnels?  */
+  /* Rule 7: Prefer native transport.  */
+  if (a1->got_source_addr)
+    {
+      if (!(a1->source_addr_flags & in6ai_temporary)
+	  && (a1->source_addr_flags & in6ai_temporary))
+	return -1;
+      if ((a1->source_addr_flags & in6ai_temporary)
+	  && !(a1->source_addr_flags & in6ai_temporary))
+	return -1;
+
+      /* XXX Do we need to check anything beside temporary addresses?  */
+    }
 
 
   /* Rule 8: Prefer smaller scope.  */
@@ -1454,15 +1472,23 @@ rfc3484_sort (const void *p1, const void *p2)
 }
 
 
+static int
+in6aicmp (const void *p1, const void *p2)
+{
+  struct in6addrinfo *a1 = (struct in6addrinfo *) p1;
+  struct in6addrinfo *a2 = (struct in6addrinfo *) p2;
+
+  return memcmp (a1->addr, a2->addr, sizeof (a1->addr));
+}
+
+
 int
 getaddrinfo (const char *name, const char *service,
 	     const struct addrinfo *hints, struct addrinfo **pai)
 {
-  int i = 0, j = 0, last_i = 0;
+  int i = 0, last_i = 0;
   int nresults = 0;
-  struct addrinfo *p = NULL, **end;
-  const struct gaih *g = gaih;
-  const struct gaih *pg = NULL;
+  struct addrinfo *p = NULL;
   struct gaih_service gaih_service, *pservice;
   struct addrinfo local_hints;
 
@@ -1490,15 +1516,23 @@ getaddrinfo (const char *name, const char *service,
   if ((hints->ai_flags & AI_CANONNAME) && name == NULL)
     return EAI_BADFLAGS;
 
+  struct in6addrinfo *in6ai;
+  size_t in6ailen;
+  bool seen_ipv4 = false;
+  bool seen_ipv6 = false;
+  /* We might need information about what kind of interfaces are available.
+     But even if AI_ADDRCONFIG is not used, if the user requested IPv6
+     addresses we have to know whether an address is deprecated or
+     temporary.  */
+  if ((hints->ai_flags & AI_ADDRCONFIG) || hints->ai_family == PF_UNSPEC
+      || hints->ai_family == PF_INET6)
+    /* Determine whether we have IPv4 or IPv6 interfaces or both.  We
+       cannot cache the results since new interfaces could be added at
+       any time.  */
+    __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+
   if (hints->ai_flags & AI_ADDRCONFIG)
     {
-      /* Determine whether we have IPv4 or IPv6 interfaces or both.
-	 We cannot cache the results since new interfaces could be
-	 added at any time.  */
-      bool seen_ipv4;
-      bool seen_ipv6;
-      __check_pf (&seen_ipv4, &seen_ipv6);
-
       /* Now make a decision on what we return, if anything.  */
       if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6))
 	{
@@ -1513,8 +1547,11 @@ getaddrinfo (const char *name, const char *service,
 	}
       else if ((hints->ai_family == PF_INET && ! seen_ipv4)
 	       || (hints->ai_family == PF_INET6 && ! seen_ipv6))
-	/* We cannot possibly return a valid answer.  */
-	return EAI_NONAME;
+	{
+	  /* We cannot possibly return a valid answer.  */
+	  free (in6ai);
+	  return EAI_NONAME;
+	}
     }
 
   if (service && service[0])
@@ -1525,7 +1562,10 @@ getaddrinfo (const char *name, const char *service,
       if (*c != '\0')
 	{
 	  if (hints->ai_flags & AI_NUMERICSERV)
-	    return EAI_NONAME;
+	    {
+	      free (in6ai);
+	      return EAI_NONAME;
+	    }
 
 	  gaih_service.num = -1;
 	}
@@ -1535,12 +1575,21 @@ getaddrinfo (const char *name, const char *service,
   else
     pservice = NULL;
 
+  struct addrinfo **end;
   if (pai)
     end = &p;
   else
     end = NULL;
 
   unsigned int naddrs = 0;
+#if 0
+  /* If we would support more protocols than just IPv4 and IPv6 we
+     would iterate over a table with appropriate callback functions.
+     Since we currently only handle IPv4 and IPv6 this is not
+     necessary.  */
+  const struct gaih *g = gaih;
+  const struct gaih *pg = NULL;
+  int j = 0;
   while (g->gaih)
     {
       if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC)
@@ -1564,6 +1613,7 @@ getaddrinfo (const char *name, const char *service,
 		    }
 
 		  freeaddrinfo (p);
+		  free (in6ai);
 
 		  return -(i & GAIH_EAI);
 		}
@@ -1579,7 +1629,35 @@ getaddrinfo (const char *name, const char *service,
     }
 
   if (j == 0)
-    return EAI_FAMILY;
+    {
+      free (in6ai);
+      return EAI_FAMILY;
+    }
+#else
+  if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
+      || hints->ai_family == AF_INET6)
+    {
+      last_i = gaih_inet (name, pservice, hints, end, &naddrs);
+      if (last_i != 0)
+	{
+	  freeaddrinfo (p);
+	  free (in6ai);
+
+	  return -(i & GAIH_EAI);
+	}
+      if (end)
+	while (*end)
+	  {
+	    end = &((*end)->ai_next);
+	    ++nresults;
+	  }
+    }
+  else
+    {
+      free (in6ai);
+      return EAI_FAMILY;
+    }
+#endif
 
   if (naddrs > 1)
     {
@@ -1589,6 +1667,11 @@ getaddrinfo (const char *name, const char *service,
       struct addrinfo *last = NULL;
       char *canonname = NULL;
 
+      /* If we have information about deprecated and temporary address
+	 sort the array now.  */
+      if (in6ai != NULL)
+	qsort (in6ai, in6ailen, sizeof (*in6ai), in6aicmp);
+
       for (i = 0, q = p; q != NULL; ++i, last = q, q = q->ai_next)
 	{
 	  results[i].dest_addr = q;
@@ -1603,9 +1686,12 @@ getaddrinfo (const char *name, const char *service,
 		      results[i - 1].source_addr_len);
 	      results[i].source_addr_len = results[i - 1].source_addr_len;
 	      results[i].got_source_addr = results[i - 1].got_source_addr;
+	      results[i].source_addr_flags = results[i - 1].source_addr_flags;
 	    }
 	  else
 	    {
+	      results[i].source_addr_flags = 0;
+
 	      /* We overwrite the type with SOCK_DGRAM since we do not
 		 want connect() to connect to the other side.  If we
 		 cannot determine the source address remember this
@@ -1620,6 +1706,20 @@ getaddrinfo (const char *name, const char *service,
 		{
 		  results[i].source_addr_len = sl;
 		  results[i].got_source_addr = true;
+
+		  if (q->ai_family == PF_INET6 && in6ai != NULL)
+		    {
+		      /* See whether the address is the list of deprecated
+			 or temporary addresses.  */
+		      struct in6addrinfo tmp;
+		      memcpy (tmp.addr, q->ai_addr, IN6ADDRSZ);
+
+		      struct in6addrinfo *found
+			= bsearch (&tmp, in6ai, in6ailen, sizeof (*in6ai),
+				   in6aicmp);
+		      if (found != NULL)
+			results[i].source_addr_flags = found->flags;
+		    }
 		}
 	      else
 		/* Just make sure that if we have to process the same
@@ -1653,6 +1753,8 @@ getaddrinfo (const char *name, const char *service,
       p->ai_canonname = canonname;
     }
 
+  free (in6ai);
+
   if (p)
     {
       *pai = p;
diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c
index 31e39d78b5..8f96e3d610 100644
--- a/sysdeps/posix/sigset.c
+++ b/sysdeps/posix/sigset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,8 +29,10 @@ sigset (sig, disp)
      int sig;
      __sighandler_t disp;
 {
-  struct sigaction act, oact;
+  struct sigaction act;
+  struct sigaction oact;
   sigset_t set;
+  sigset_t oset;
 
 #ifdef SIG_HOLD
   /* Handle SIG_HOLD first.  */
@@ -45,10 +47,18 @@ sigset (sig, disp)
 	return SIG_ERR;
 
       /* Add the signal set to the current signal mask.  */
-      if (__sigprocmask (SIG_BLOCK, &set, NULL) < 0)
+      if (__sigprocmask (SIG_BLOCK, &set, &oset) < 0)
 	return SIG_ERR;
 
-      return SIG_HOLD;
+      /* If the signal was already blocked signal this to the caller.  */
+      if (__sigismember (&oset, sig))
+	return SIG_HOLD;
+
+      /* We need to determine whether a specific handler is installed.  */
+      if (__sigaction (sig, NULL, &oact) < 0)
+	return SIG_ERR;
+
+      return oact.sa_handler;
     }
 #endif	/* SIG_HOLD */
 
@@ -75,8 +85,9 @@ sigset (sig, disp)
     return SIG_ERR;
 
   /* Remove the signal set from the current signal mask.  */
-  if (__sigprocmask (SIG_UNBLOCK, &set, NULL) < 0)
+  if (__sigprocmask (SIG_UNBLOCK, &set, &oset) < 0)
     return SIG_ERR;
 
-  return oact.sa_handler;
+  /* If the signal was already blocked return SIG_HOLD.  */
+  return __sigismember (&oset, sig) ? SIG_HOLD : oact.sa_handler;
 }
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 0d4bbc418a..c8973a0852 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -242,11 +242,15 @@ __gen_tempname (char *tmpl, int kind)
      necessary to try all these combinations.  Instead if a reasonable
      number of names is tried (we define reasonable as 62**3) fail to
      give the system administrator the chance to remove the problems.  */
-  unsigned int attempts_min = 62 * 62 * 62;
+#define ATTEMPTS_MIN (62 * 62 * 62)
 
   /* The number of times to attempt to generate a temporary file.  To
      conform to POSIX, this must be no smaller than TMP_MAX.  */
-  unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min;
+#if ATTEMPTS_MIN < TMP_MAX
+  unsigned int attempts = TMP_MAX;
+#else
+  unsigned int attempts = ATTEMPTS_MIN;
+#endif
 
   len = strlen (tmpl);
   if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
diff --git a/sysdeps/powerpc/fpu/bits/mathinline.h b/sysdeps/powerpc/fpu/bits/mathinline.h
index 15da56384e..aed899e882 100644
--- a/sysdeps/powerpc/fpu/bits/mathinline.h
+++ b/sysdeps/powerpc/fpu/bits/mathinline.h
@@ -129,7 +129,7 @@ __NTH (fdimf (float __x, float __y))
 #include <ldsodefs.h>
 #include <dl-procinfo.h>
 
-# if __WORDSIZE == 64
+# if __WORDSIZE == 64 || defined _ARCH_PWR4
 #  define __CPU_HAS_FSQRT 1
 # else
 #  define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
@@ -141,7 +141,7 @@ __NTH (__ieee754_sqrt (double __x))
 {
   double __z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
   if (__CPU_HAS_FSQRT)
   {
     /* Volatile is required to prevent the compiler from moving the
@@ -163,7 +163,7 @@ __NTH (__ieee754_sqrtf (float __x))
 {
   float __z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
   if (__CPU_HAS_FSQRT)
   {
     /* Volatile is required to prevent the compiler from moving the
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index e6ba1f979f..540b924656 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -169,8 +169,8 @@ __ieee754_sqrt (x)
 {
   double z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
-  if ((GLRO (dl_hwcap) & PPC_FEATURE_64) != 0)
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
+  if (__CPU_HAS_FSQRT)
     {
       /* Volatile is required to prevent the compiler from moving the 
          fsqrt instruction above the branch.  */
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index 335935bb18..b63d31472b 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -146,8 +146,8 @@ __ieee754_sqrtf (x)
 {
   double z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
-  if ((GLRO (dl_hwcap) & PPC_FEATURE_64) != 0)
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
+  if (__CPU_HAS_FSQRT)
     {
       /* Volatile is required to prevent the compiler from moving the 
          fsqrt instruction above the branch.  */
diff --git a/sysdeps/powerpc/powerpc32/bits/atomic.h b/sysdeps/powerpc/powerpc32/bits/atomic.h
index 0f1a72335f..6fcc669fb1 100644
--- a/sysdeps/powerpc/powerpc32/bits/atomic.h
+++ b/sysdeps/powerpc/powerpc32/bits/atomic.h
@@ -89,12 +89,27 @@
 # define __arch_atomic_decrement_if_positive_64(mem) \
     ({ abort (); (*mem)--; })
 
+#ifdef _ARCH_PWR4
+/*
+ * Newer powerpc64 processors support the new "light weight" sync (lwsync)
+ * So if the build is using -mcpu=[power4,power5,power5+,970] we can
+ * safely use lwsync.
+ */
+# define atomic_read_barrier()	__asm ("lwsync" ::: "memory")
+/*
+ * "light weight" sync can also be used for the release barrier.
+ */
+# ifndef UP
+#  define __ARCH_REL_INSTR	"lwsync"
+# endif
+#else
 /*
  * Older powerpc32 processors don't support the new "light weight"
  * sync (lwsync).  So the only safe option is to use normal sync
  * for all powerpc32 applications.
  */
 # define atomic_read_barrier()	__asm ("sync" ::: "memory")
+#endif
 
 /*
  * Include the rest of the atomic ops macros which are common to both
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index fed28f2db0..ad7a8701fd 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -123,6 +123,9 @@ libc {
     #errlist-compat	132
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
+  GLIBC_2.5 {
+    splice; sync_file_range; tee;
+  }
   GLIBC_PRIVATE {
     # functions used in other libraries
     __syscall_rt_sigqueueinfo;
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index c4a9b77e2e..6898fe8743 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995-1999, 2000, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -173,10 +173,41 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 77e9b83c92..356a2ece74 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux version.
-   Copyright (C) 1991,1992,1994-2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -221,7 +221,10 @@ struct msghdr
     size_t msg_iovlen;		/* Number of elements in the vector.  */
 
     void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
-    size_t msg_controllen;	/* Ancillary data buffer length.  */
+    size_t msg_controllen;	/* Ancillary data buffer length.
+				   !! The type should be socklen_t but the
+				   definition of the kernel is incompatible
+				   with this.  */
 
     int msg_flags;		/* Flags on received message.  */
   };
@@ -230,7 +233,10 @@ struct msghdr
 struct cmsghdr
   {
     size_t cmsg_len;		/* Length of data in cmsg_data plus length
-				   of cmsghdr structure.  */
+				   of cmsghdr structure.
+				   !! The type should be socklen_t but the
+				   definition of the kernel is incompatible
+				   with this.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
 #if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index ae6f71d89c..f186182cf6 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -29,11 +29,18 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
+#include <not-cancel.h>
 #include <kernel-features.h>
 
 
+#ifndef IFA_F_TEMPORARY
+# define IFA_F_TEMPORARY IFA_F_SECONDARY
+#endif
+
+
 static int
-make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
+make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
+	      struct in6addrinfo **in6ai, size_t *in6ailen)
 {
   struct
   {
@@ -63,6 +70,12 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
   bool done = false;
   char buf[4096];
   struct iovec iov = { buf, sizeof (buf) };
+  struct in6ailist
+  {
+    struct in6addrinfo info;
+    struct in6ailist *next;
+  } *in6ailist = NULL;
+  size_t in6ailistlen = 0;
 
   do
     {
@@ -101,6 +114,42 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 		  break;
 		case AF_INET6:
 		  *seen_ipv6 = true;
+
+		  if (ifam->ifa_flags & (IFA_F_DEPRECATED | IFA_F_TEMPORARY))
+		    {
+		      struct rtattr *rta = IFA_RTA (ifam);
+		      size_t len = (nlmh->nlmsg_len
+				    - NLMSG_LENGTH (sizeof (*ifam)));
+		      void *local = NULL;
+		      void *address = NULL;
+		      while (RTA_OK (rta, len))
+			{
+			  switch (rta->rta_type)
+			    {
+			    case IFA_LOCAL:
+			      local = RTA_DATA (rta);
+			      break;
+
+			    case IFA_ADDRESS:
+			      address = RTA_DATA (rta);
+			      break;
+			    }
+
+			  rta = RTA_NEXT (rta, len);
+			}
+
+		      struct in6ailist *newp = alloca (sizeof (*newp));
+		      newp->info.flags = (((ifam->ifa_flags & IFA_F_DEPRECATED)
+					   ? in6ai_deprecated : 0)
+					  | ((ifam->ifa_flags
+					      & IFA_F_TEMPORARY)
+					     ? in6ai_temporary : 0));
+		      memcpy (newp->info.addr, address ?: local,
+			      sizeof (newp->info.addr));
+		      newp->next = in6ailist;
+		      in6ailist = newp;
+		      ++in6ailistlen;
+		    }
 		  break;
 		default:
 		  /* Ignore.  */
@@ -110,12 +159,27 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 	  else if (nlmh->nlmsg_type == NLMSG_DONE)
 	    /* We found the end, leave the loop.  */
 	    done = true;
-	  else ;
 	}
     }
   while (! done);
 
-  __close (fd);
+  close_not_cancel_no_status (fd);
+
+  if (in6ailist != NULL)
+    {
+      *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
+      if (*in6ai == NULL)
+	return -1;
+
+      *in6ailen = in6ailistlen;
+
+      do
+	{
+	  (*in6ai)[--in6ailistlen] = in6ailist->info;
+	  in6ailist = in6ailist->next;
+	}
+      while (in6ailist != NULL);
+    }
 
   return 0;
 }
@@ -133,8 +197,12 @@ extern int __no_netlink_support attribute_hidden;
 
 void
 attribute_hidden
-__check_pf (bool *seen_ipv4, bool *seen_ipv6)
+__check_pf (bool *seen_ipv4, bool *seen_ipv6,
+	    struct in6addrinfo **in6ai, size_t *in6ailen)
 {
+  *in6ai = NULL;
+  *in6ailen = 0;
+
   if (! __no_netlink_support)
     {
       int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
@@ -148,7 +216,8 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6)
       if (fd >= 0
 	  && __bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
 	  && __getsockname (fd, (struct sockaddr *) &nladdr, &addr_len) == 0
-	  && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6) == 0)
+	  && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6,
+			   in6ai, in6ailen) == 0)
 	/* It worked.  */
 	return;
 
@@ -178,9 +247,6 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6)
       return;
     }
 
-  *seen_ipv4 = false;
-  *seen_ipv6 = false;
-
   struct ifaddrs *runp;
   for (runp = ifa; runp != NULL; runp = runp->ifa_next)
     if (runp->ifa_addr->sa_family == PF_INET)
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index 1a308ca38f..911d85f43d 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -87,7 +87,7 @@ __getcwd (char *buf, size_t size)
 	  return NULL;
 	}
 
-      alloc_size = PATH_MAX;
+      alloc_size = MAX (PATH_MAX, __getpagesize ());
     }
 
   if (buf == NULL)
diff --git a/sysdeps/unix/sysv/linux/getsourcefilter.c b/sysdeps/unix/sysv/linux/getsourcefilter.c
index fdcf8d6130..a6f89a3cc9 100644
--- a/sysdeps/unix/sysv/linux/getsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/getsourcefilter.c
@@ -1,5 +1,5 @@
 /* Get source filter.  Linux version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -112,23 +112,27 @@ getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
   gf->gf_numsrc = *numsrc;
 
   /* We need to provide the appropriate socket level value.  */
+  int result;
   int sol = __get_sol (group->sa_family, grouplen);
   if (sol == -1)
     {
       __set_errno (EINVAL);
-      return -1;
+      result = -1;
     }
-
-  int result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
-
-  /* If successful, copy the results to the places the caller wants
-     them in.  */
-  if (result == 0)
+  else
     {
-      *fmode = gf->gf_fmode;
-      memcpy (slist, gf->gf_slist,
-	      MIN (*numsrc, gf->gf_numsrc) * sizeof (struct sockaddr_storage));
-      *numsrc = gf->gf_numsrc;
+      result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
+
+      /* If successful, copy the results to the places the caller wants
+	 them in.  */
+      if (result == 0)
+	{
+	  *fmode = gf->gf_fmode;
+	  memcpy (slist, gf->gf_slist,
+		  MIN (*numsrc, gf->gf_numsrc)
+		  * sizeof (struct sockaddr_storage));
+	  *numsrc = gf->gf_numsrc;
+	}
     }
 
   if (! use_alloca)
diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
index 9065825b98..a375888106 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -180,10 +180,41 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/i386/sync_file_range.S b/sysdeps/unix/sysv/linux/i386/sync_file_range.S
new file mode 100644
index 0000000000..f39e8a00d7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/sync_file_range.S
@@ -0,0 +1,72 @@
+/* Selective file content synch'ing.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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 <sysdep.h>
+#define _ERRNO_H        1
+#include <bits/errno.h>
+
+
+	.text
+ENTRY (sync_file_range)
+#ifdef __NR_sync_file_range
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%esi
+	cfi_adjust_cfa_offset (4)
+	pushl	%edi
+	cfi_adjust_cfa_offset (4)
+	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
+
+	movl	20(%esp), %ebx
+	cfi_rel_offset (ebx, 12)
+	movl	24(%esp), %ecx
+	movl	28(%esp), %edx
+	movl	32(%esp), %esi
+	cfi_rel_offset (esi, 8)
+	movl	36(%esp), %edi
+	cfi_rel_offset (edi, 4)
+	movl	40(%esp), %ebp
+	cfi_rel_offset (ebp, 0)
+
+	movl	$SYS_ify(sync_file_range), %eax
+	ENTER_KERNEL
+
+	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
+	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+
+	cmpl	$-4095, %eax
+	jae	SYSCALL_ERROR_LABEL
+L(pseudo_end):
+	ret
+#else
+	movl	$-ENOSYS, %eax
+	jmp	SYSCALL_ERROR_LABEL
+#endif
+PSEUDO_END (sync_file_range)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index cb5767955c..90423d8434 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,2005
+/* Copyright (C) 1992,1993,1995-2000,2002-2005,2006
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
@@ -447,7 +447,7 @@ asm (".L__X'%ebx = 1\n\t"
 
 #define LOADARGS_0
 #ifdef __PIC__
-# if defined I386_USE_SYSENTER
+# if defined I386_USE_SYSENTER && defined SHARED
 #  define LOADARGS_1 \
     "bpushl .L__X'%k3, %k3\n\t"
 #  define LOADARGS_5 \
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index d330954d48..63a771ddb9 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/IA64.
-   Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -174,10 +174,41 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 37d25b1a5c..139e3d5a72 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -85,6 +85,12 @@
 # define __ASSUME_SENDFILE		1
 #endif
 
+/* Only very old kernels had no real symlinks for terminal descriptors
+   in /proc/self/fd.  */
+#if __LINUX_KERNEL_VERSION >= 131584
+# define __ASSUME_PROC_SELF_FD_SYMLINK	1
+#endif
+
 /* On x86 another `getrlimit' syscall was added in 2.3.25.  */
 #if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__
 # define __ASSUME_NEW_GETRLIMIT_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 19649c01c7..2219271a1b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/PowerPC.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -180,10 +180,41 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
index f4c92ad7c7..37b777799c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
@@ -84,6 +84,10 @@ ENTRY (BP_SYM (__clone))
 	mr	r6,r8
 	mr	r7,r9
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	/* Do the call.  */
 	DO_CALL(SYS_ify(clone))
 
@@ -138,6 +142,8 @@ L(parent):
 L(badargs):
 	li	r3,EINVAL
 	b	__syscall_error@local
+
+	cfi_startproc
 END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index 366206d286..f1a55e64db 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -81,6 +81,10 @@ ENTRY (BP_SYM (__clone))
 	mr	r6,r8
 	mr	r7,r9
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	/* Do the call.  */
 	DO_CALL(SYS_ify(clone))
 
@@ -132,6 +136,8 @@ L(parent):
 L(badargs):
 	li	r3,EINVAL
 	b	JUMPTARGET(__syscall_error)
+
+	cfi_startproc
 END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
index d2d5972411..577689f18d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
@@ -35,7 +35,7 @@ __BEGIN_DECLS
 /* These definitions are normally provided by ucontext.h via 
    asm/sigcontext.h, asm/ptrace.h, and asm/elf.h.  Otherwise we define 
    them here.  */ 
-#ifndef __PPC64_ELF_H
+#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H
 #define ELF_NGREG       48      /* includes nip, msr, lr, etc. */
 #define ELF_NFPREG      33      /* includes fpscr */
 #if __WORDSIZE == 32
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index c2f21ee4ca..9b4a730c0e 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -29,7 +29,7 @@
 
 /* Read the contents of the symbolic link PATH relative to FD into no
    more than LEN bytes of BUF.  */
-int
+ssize_t
 readlinkat (fd, path, buf, len)
      int fd;
      const char *path;
diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index 8c47077580..ad3ef420a1 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -199,10 +199,41 @@ struct flock64
 # endif
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/setsourcefilter.c b/sysdeps/unix/sysv/linux/setsourcefilter.c
index f5c4d9786f..dc223de844 100644
--- a/sysdeps/unix/sysv/linux/setsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/setsourcefilter.c
@@ -1,5 +1,5 @@
 /* Set source filter.  Linux version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -57,14 +57,15 @@ setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
   memcpy (gf->gf_slist, slist, numsrc * sizeof (struct sockaddr_storage));
 
   /* We need to provide the appropriate socket level value.  */
+  int result;
   int sol = __get_sol (group->sa_family, grouplen);
   if (sol == -1)
     {
       __set_errno (EINVAL);
-      return -1;
+      result = -1;
     }
-
-  int result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
+  else
+    result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
 
   if (! use_alloca)
     {
diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index 9065825b98..a375888106 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -180,10 +180,41 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 5dc8bf32f0..b3788f0daf 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/SPARC.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -199,10 +199,41 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/sync_file_range.c b/sysdeps/unix/sysv/linux/sync_file_range.c
new file mode 100644
index 0000000000..aabe192341
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sync_file_range.c
@@ -0,0 +1,46 @@
+/* Selective file content synch'ing.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   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 <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+
+#ifdef __NR_sync_file_range
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, int flags)
+{
+  return INLINE_SYSCALL (sync_file_range, 6, fd, (off_t) (from >> 32),
+			 (off_t) (from & 0xffffffff), (off_t) (to >> 32),
+			 (off_t) (to & 0xffffffff), flags);
+}
+#else
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, int flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (sync_file_range)
+
+# include <stub-tag.h>
+#endif
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 053d7e0ccf..6bfccd26aa 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -70,9 +70,11 @@ setfsgid	EXTRA	setfsgid	i:i	setfsgid
 setfsuid	EXTRA	setfsuid	i:i	setfsuid
 setpgid		-	setpgid		i:ii	__setpgid	setpgid
 sigaltstack	-	sigaltstack	i:PP	__sigaltstack	sigaltstack
+splice		EXTRA	splice		i:iiii	splice
 sysinfo		EXTRA	sysinfo		i:p	sysinfo
 swapon		-	swapon		i:si	__swapon	swapon
 swapoff		-	swapoff		i:s	__swapoff	swapoff
+tee		EXTRA	tee		i:iiii	tee
 unshare		EXTRA	unshare		i:i	unshare
 uselib		EXTRA	uselib		i:s	uselib
 wait4		-	wait4		i:iWiP	__wait4		wait4
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 68d24f195e..aed0fd8e0a 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1996-2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1996-2002,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 
 #include <stdio-common/_itoa.h>
+#include <kernel-features.h>
 
 #if 0
 /* Is this used anywhere?  It is not exported.  */
@@ -41,7 +42,7 @@ static char *getttyname (const char *dev, dev_t mydev,
 libc_freeres_ptr (static char *getttyname_name);
 
 static char *
-internal_function
+internal_function attribute_compat_text_section
 getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat)
 {
   static size_t namelen;
@@ -117,10 +118,12 @@ ttyname (int fd)
   int dostat = 0;
   char *name;
   int save = errno;
-  int len;
 
-  if (!__isatty (fd))
-    return NULL;
+  if (__builtin_expect (!__isatty (fd), 0))
+    {
+      __set_errno (ENOTTY);
+      return NULL;
+    }
 
   /* We try using the /proc filesystem.  */
   *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
@@ -136,10 +139,19 @@ ttyname (int fd)
 	}
     }
 
-  len = __readlink (procname, ttyname_buf, buflen);
-  if (len != -1
-      /* This is for Linux 2.0.  */
-      && ttyname_buf[0] != '[')
+  ssize_t len = __readlink (procname, ttyname_buf, buflen);
+  if (__builtin_expect (len == -1 && errno == ENOENT, 0))
+    {
+      __set_errno (EBADF);
+      return NULL;
+    }
+
+  if (__builtin_expect (len != -1
+#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
+			/* This is for Linux 2.0.  */
+			&& ttyname_buf[0] != '['
+#endif
+			, 1))
     {
       if ((size_t) len >= buflen)
 	return NULL;
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index eee4d862b2..bd415f167b 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1995-2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1995-2001,2003,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,13 +27,14 @@
 #include <stdlib.h>
 
 #include <stdio-common/_itoa.h>
+#include <kernel-features.h>
 
 static int getttyname_r (char *buf, size_t buflen,
 			 dev_t mydev, ino64_t myino, int save,
 			 int *dostat) internal_function;
 
 static int
-internal_function
+internal_function attribute_compat_text_section
 getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino,
 	      int save, int *dostat)
 {
@@ -99,7 +100,6 @@ __ttyname_r (int fd, char *buf, size_t buflen)
   struct stat64 st, st1;
   int dostat = 0;
   int save = errno;
-  int ret;
 
   /* Test for the absolute minimal size.  This makes life easier inside
      the loop.  */
@@ -115,29 +115,34 @@ __ttyname_r (int fd, char *buf, size_t buflen)
       return ERANGE;
     }
 
+  if (__builtin_expect (!__isatty (fd), 0))
+    {
+      __set_errno (ENOTTY);
+      return ENOTTY;
+    }
+
   /* We try using the /proc filesystem.  */
   *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
 
-  ret = __readlink (procname, buf, buflen - 1);
-  if (ret == -1 && errno == ENOENT)
+  ssize_t ret = __readlink (procname, buf, buflen - 1);
+  if (__builtin_expect (ret == -1 && errno == ENOENT, 0))
     {
       __set_errno (EBADF);
       return EBADF;
     }
 
-  if (!__isatty (fd))
-    {
-      __set_errno (ENOTTY);
-      return ENOTTY;
-    }
-
-  if (ret == -1 && errno == ENAMETOOLONG)
+  if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0))
     {
       __set_errno (ERANGE);
       return ERANGE;
     }
 
-  if (ret != -1 && buf[0] != '[')
+  if (__builtin_expect (ret != -1
+#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
+			/* This is for Linux 2.0.  */
+			&& buf[0] != '['
+#endif
+			, 1))
     {
       buf[ret] = '\0';
       return 0;
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 58904fc4d4..d377db9687 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -14,3 +14,4 @@ getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit getrlimit64
 setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit setrlimit64
 readahead	-	readahead	i:iii	__readahead	readahead
 sendfile	-	sendfile	i:iipi	sendfile	sendfile64
+sync_file_range	-	sync_file_range	i:iiii	sync_file_range
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
index 9198c70bd4..2351737f7c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/x86-64.
-   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -194,10 +194,41 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice two files together.  */
+extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS