aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-07-21 08:25:57 +0000
committerJakub Jelinek <jakub@redhat.com>2005-07-21 08:25:57 +0000
commit736e2ab430e006ba09a2fe34d7887d3812ac808f (patch)
treef2d5948776e91112fcfd9199a757cd58e1be867a
parent366c71f353afc163b8d31c9db6e90919b5c2e1c0 (diff)
downloadglibc-736e2ab430e006ba09a2fe34d7887d3812ac808f.zip
glibc-736e2ab430e006ba09a2fe34d7887d3812ac808f.tar.gz
glibc-736e2ab430e006ba09a2fe34d7887d3812ac808f.tar.bz2
Updated to fedora-glibc-20050721T0814
-rw-r--r--ChangeLog314
-rw-r--r--Makerules2
-rw-r--r--argp/argp-fmtstream.c40
-rw-r--r--argp/argp-help.c103
-rw-r--r--assert/assert-perr.c10
-rw-r--r--assert/assert.c11
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure30
-rw-r--r--configure.in15
-rw-r--r--debug/Depend1
-rw-r--r--debug/Makefile28
-rw-r--r--debug/Versions9
-rw-r--r--debug/confstr_chk.c30
-rw-r--r--debug/fgetws_chk.c54
-rw-r--r--debug/fgetws_u_chk.c61
-rw-r--r--debug/fwprintf_chk.c45
-rw-r--r--debug/getdomainname_chk.c29
-rw-r--r--debug/getgroups_chk.c30
-rw-r--r--debug/gethostname_chk.c29
-rw-r--r--debug/getlogin_r_chk.c29
-rw-r--r--debug/mbsnrtowcs_chk.c31
-rw-r--r--debug/mbsrtowcs_chk.c31
-rw-r--r--debug/ptsname_r_chk.c29
-rw-r--r--debug/realpath_chk.c60
-rw-r--r--debug/swprintf_chk.c37
-rw-r--r--debug/tst-chk1.c480
-rw-r--r--debug/ttyname_r_chk.c29
-rw-r--r--debug/vfwprintf_chk.c42
-rw-r--r--debug/vswprintf_chk.c75
-rw-r--r--debug/vwprintf_chk.c43
-rw-r--r--debug/wcpcpy_chk.c45
-rw-r--r--debug/wcpncpy_chk.c33
-rw-r--r--debug/wcrtomb_chk.c35
-rw-r--r--debug/wcscat_chk.c55
-rw-r--r--debug/wcscpy_chk.c61
-rw-r--r--debug/wcsncat_chk.c96
-rw-r--r--debug/wcsncpy_chk.c33
-rw-r--r--debug/wcsnrtombs_chk.c31
-rw-r--r--debug/wcsrtombs_chk.c31
-rw-r--r--debug/wctomb_chk.c36
-rw-r--r--debug/wmemcpy_chk.c30
-rw-r--r--debug/wmemmove_chk.c30
-rw-r--r--debug/wmempcpy_chk.c31
-rw-r--r--debug/wmemset_chk.c30
-rw-r--r--debug/wprintf_chk.c46
-rw-r--r--fedora/branch.mk4
-rw-r--r--gmon/gmon.c12
-rw-r--r--include/bits/stdlib.h1
-rw-r--r--include/bits/wchar2.h1
-rw-r--r--include/fenv.h2
-rw-r--r--include/libc-symbols.h18
-rw-r--r--include/stdio.h2
-rw-r--r--include/stdlib.h4
-rw-r--r--include/time.h2
-rw-r--r--include/wchar.h9
-rw-r--r--inet/rcmd.c99
-rw-r--r--libio/strfile.h13
-rw-r--r--libio/vswprintf.c13
-rw-r--r--localedata/ChangeLog10
-rw-r--r--localedata/locales/vi_VN390
-rw-r--r--malloc/obstack.c11
-rw-r--r--manual/Makefile2
-rw-r--r--misc/Makefile15
-rw-r--r--misc/error.c77
-rw-r--r--misc/getpass.c20
-rw-r--r--misc/tst-error1.c26
-rw-r--r--nptl/ChangeLog21
-rw-r--r--nptl/Makefile3
-rw-r--r--nptl/sysdeps/pthread/pthread.h27
-rw-r--r--nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h7
-rw-r--r--nptl/tst-initializers1.c48
-rw-r--r--nscd/Makefile5
-rw-r--r--nscd/connections.c25
-rw-r--r--nscd/grpcache.c2
-rw-r--r--nscd/nscd.c4
-rw-r--r--nscd/nscd_helper.c106
-rw-r--r--posix/bits/unistd.h98
-rw-r--r--posix/getopt.c50
-rw-r--r--posix/regcomp.c4
-rw-r--r--resolv/res_hconf.c60
-rw-r--r--stdio-common/Makefile2
-rw-r--r--stdio-common/fxprintf.c54
-rw-r--r--stdio-common/perror.c7
-rw-r--r--stdio-common/psignal.c21
-rw-r--r--stdlib/Makefile2
-rw-r--r--stdlib/bits/stdlib.h75
-rw-r--r--stdlib/fmtmsg.c51
-rw-r--r--stdlib/stdlib.h8
-rw-r--r--string/bits/string3.h16
-rw-r--r--sunrpc/auth_unix.c8
-rw-r--r--sunrpc/clnt_perr.c21
-rw-r--r--sunrpc/clnt_tcp.c8
-rw-r--r--sunrpc/clnt_udp.c8
-rw-r--r--sunrpc/clnt_unix.c8
-rw-r--r--sunrpc/svc_simple.c14
-rw-r--r--sunrpc/svc_tcp.c16
-rw-r--r--sunrpc/svc_udp.c29
-rw-r--r--sunrpc/svc_unix.c16
-rw-r--r--sunrpc/xdr.c15
-rw-r--r--sunrpc/xdr_array.c8
-rw-r--r--sunrpc/xdr_rec.c7
-rw-r--r--sunrpc/xdr_ref.c9
-rw-r--r--sysdeps/alpha/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/alpha/fpu/fesetround.c3
-rw-r--r--sysdeps/generic/clock_gettime.c3
-rw-r--r--sysdeps/generic/feholdexcpt.c3
-rw-r--r--sysdeps/generic/fesetround.c3
-rw-r--r--sysdeps/generic/s_significand.c2
-rw-r--r--sysdeps/generic/s_significandf.c4
-rw-r--r--sysdeps/generic/stpncpy_chk.c85
-rw-r--r--sysdeps/generic/wordexp.c7
-rw-r--r--sysdeps/i386/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/i386/fpu/fesetround.c3
-rw-r--r--sysdeps/ia64/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/ia64/fpu/fesetround.c3
-rw-r--r--sysdeps/ieee754/dbl-64/s_sincos.c6
-rw-r--r--sysdeps/ieee754/flt-32/e_atan2f.c2
-rw-r--r--sysdeps/powerpc/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/powerpc/fpu/fesetround.c3
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps15
-rw-r--r--sysdeps/s390/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/s390/fpu/fesetround.c3
-rw-r--r--sysdeps/s390/fpu/libm-test-ulps15
-rw-r--r--sysdeps/s390/s390-64/bcopy.S14
-rw-r--r--sysdeps/sh/sh4/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/sh/sh4/fpu/fesetround.c3
-rw-r--r--sysdeps/sparc/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/sparc/fpu/fesetround.c3
-rw-r--r--sysdeps/unix/clock_gettime.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/has_cpuclock.c12
-rw-r--r--sysdeps/x86_64/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/x86_64/fpu/fesetround.c3
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps15
-rw-r--r--sysdeps/x86_64/fpu/s_sincos.S61
-rw-r--r--sysdeps/x86_64/fpu/s_sincosl.S7
-rw-r--r--wcsmbs/bits/wchar2.h398
-rw-r--r--wcsmbs/wchar.h7
-rw-r--r--wcsmbs/wcsncpy.c5
138 files changed, 3786 insertions, 872 deletions
diff --git a/ChangeLog b/ChangeLog
index 66ad07c..9f8bfa8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,281 @@
+2005-07-20 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/fpu/libm-test-ulps: Adjust expected atan2f results.
+ * sysdeps/powerpc/fpu/libm-test-ulps: Likewise.
+ * sysdeps/s390/fpu/libm-test-ulps: Likewise.
+
+2005-07-20 Bob Wilson <bob.wilson@acm.org>
+ Darin Petkov <darin@tensilica.com>
+
+ * sysdeps/ieee754/flt-32/e_atan2f.c (pi_lo): Correct exponent value.
+
+2005-07-20 Jakub Jelinek <jakub@redhat.com>
+
+ * include/stdio.h (__fxprintf): Remove wfmt argument.
+ * stdio-common/fxprintf.c: Include assert.h, ctype.h and wchar.h.
+ (__fxprintf): Remove wfmt argument, create wfmt format string on
+ the fly from fmt.
+ * argp/argp-fmtstream.c: Adjust all __fxprintf callers.
+ * argp/argp-help.c: Likewise.
+ * assert/assert-perr.c: Likewise.
+ * assert/assert.c: Likewise.
+ * gmon/gmon.c: Likewise.
+ * inet/rcmd.c: Likewise.
+ * malloc/obstack.c: Likewise.
+ * misc/error.c: Likewise.
+ * misc/getpass.c: Likewise.
+ * posix/getopt.c: Likewise.
+ * resolv/res_hconf.c: Likewise.
+ * stdio-common/perror.c: Likewise.
+ * stdio-common/psignal.c: Likewise.
+ * stdlib/fmtmsg.c: Likewise.
+ * sunrpc/auth_unix.c: Likewise.
+ * sunrpc/clnt_perr.c: Likewise.
+ * sunrpc/clnt_tcp.c: Likewise.
+ * sunrpc/clnt_udp.c: Likewise.
+ * sunrpc/clnt_unix.c: Likewise.
+ * sunrpc/svc_simple.c: Likewise.
+ * sunrpc/svc_tcp.c: Likewise.
+ * sunrpc/svc_udp.c: Likewise.
+ * sunrpc/svc_unix.c: Likewise.
+ * sunrpc/xdr.c: Likewise.
+ * sunrpc/xdr_array.c: Likewise.
+ * sunrpc/xdr_rec.c: Likewise.
+ * sunrpc/xdr_ref.c: Likewise.
+ * sysdeps/generic/wordexp.c: Likewise.
+
+2005-07-20 Ulrich Drepper <drepper@redhat.com>
+
+ * wcsmbs/bits/wchar2.h: Add definitions for wcrtomb, mbsrtowcs,
+ wcsrtombs, mbsnrtowcs, and wcsnrtombs.
+ * debug/Makefile (routines): Add wcrtomb_chk, mbsrtowcs_chk,
+ wcsrtombs_chk, mbsnrtowcs_chk, and wcsnrtombs_chk.
+ * debug/Versions: Add __wcrtomb_chk, __mbsrtowcs_chk,
+ __wcsrtombs_chk, __mbsnrtowcs_chk, and __wcsnrtombs_chk.
+ * debug/tst-chk1.c: Add tests for new functions.
+ * debug/mbsnrtowcs_chk.c: New file.
+ * debug/mbsrtowcs_chk.c: New file.
+ * debug/wcrtomb_chk.c: New file.
+ * debug/wcsnrtombs_chk.c: New file.
+ * debug/wcsrtombs_chk.c: New file.
+
+2005-07-19 Ulrich Drepper <drepper@redhat.com>
+
+ * stdio-common/Makefile (aux): Add fxprintf.
+ * stdio-common/fxprintf.c: New file.
+ * include/stdio.h: Add declaration for __fxprintf.
+ * argp/argp-fmtstream.c: Use __fxprintf instead of inline stream
+ orientation test and two separate function calls.
+ * argp/argp-help.c: Likewise.
+ * assert/assert-perr.c: Likewise.
+ * assert/assert.c: Likewise.
+ * gmon/gmon.c: Likewise.
+ * inet/rcmd.c: Likewise.
+ * malloc/obstack.c: Likewise.
+ * misc/error.c: Likewise.
+ * misc/getpass.c: Likewise.
+ * posix/getopt.c: Likewise.
+ * resolv/res_hconf.c: Likewise.
+ * stdio-common/perror.c: Likewise.
+ * stdio-common/psignal.c: Likewise.
+ * stdlib/fmtmsg.c: Likewise.
+ * sunrpc/auth_unix.c: Likewise.
+ * sunrpc/clnt_perr.c: Likewise.
+ * sunrpc/clnt_tcp.c: Likewise.
+ * sunrpc/clnt_udp.c: Likewise.
+ * sunrpc/clnt_unix.c: Likewise.
+ * sunrpc/svc_simple.c: Likewise.
+ * sunrpc/svc_tcp.c: Likewise.
+ * sunrpc/svc_udp.c: Likewise.
+ * sunrpc/svc_unix.c: Likewise.
+ * sunrpc/xdr.c: Likewise.
+ * sunrpc/xdr_array.c: Likewise.
+ * sunrpc/xdr_rec.c: Likewise.
+ * sunrpc/xdr_ref.c: Likewise.
+ * sysdeps/generic/wordexp.c: Likewise.
+
+ * misc/Makefile: Add rules to build and run tst-error1.
+ * misc/tst-error1.c: New file.
+ * misc/error.c: Fix memory leak and possibly endless loop.
+
+ * configure.in: Check for -fstack-protector gcc option.
+ * config.make.in (have-ssp): Add template.
+ * nscd/Makefile (nscd-cflags): Add -fstack-protector if supported.
+
+ * nscd/nscd.c (main): Don't ignore result of chdir call.
+
+2005-07-18 Roland McGrath <roland@redhat.com>
+
+ [BZ #869]
+ * Makerules ($(objpfx)stubs): Do cd into $(objdir) to reduce size of
+ objdump command line.
+
+2005-07-18 Ulrich Drepper <drepper@redhat.com>
+
+ * nscd/Makefile (nscd-cflags): Add _FORTIFY_SOURCE.
+
+ * nscd/connections.c: Fix a few wur warnings.
+
+ [BZ #1113]
+ * nscd/grpcache.c (cache_addgr): Use correct maximum for group ID
+ length. Patch by Ivan Gyurdiev <ivg2@cornell.edu>.
+
+ * debug/confstr_chk.c: New file.
+ * debug/getdomainname_chk.c: New file.
+ * debug/getgroups_chk.c: New file.
+ * debug/gethostname_chk.c: New file.
+ * debug/getlogin_r_chk.c: New file.
+ * debug/ttyname_r_chk.c: New file.
+ * posix/bits/unistd.h: Add definitions for new debug versions.
+ * debug/tst-chk1.c: Add tests for new functions.
+ * debug/Versions: Export new functions.
+ * debug/Makefile (routines): Add new files.
+
+ * stdlib/bits/stdlib.h: Fix typo.
+
+2005-07-13 Thorsten Kukuk <kukuk@suse.de>
+
+ * manual/Makefile (libc/index.html): Depend on dir-add.texi.
+
+2005-07-15 Ulrich Drepper <drepper@redhat.com>
+
+ * stdlib/bits/stdlib.h: Use __REDIRECT_NTH instead of __REDIRECT
+ where necessary.
+ * wcsmbs/bits/wchar2.h: Likewise.
+
+2005-07-15 Andreas Jaeger <aj@suse.de>
+
+ * debug/Makefile (tst-lfschk3-ENV): New, set locale.
+ (tst-lfschk2-ENV): New.
+ (tst-lfschk1-ENV): New.
+ (tst-chk3-ENV): New.
+ (tst-chk2-ENV): New.
+ (tst-chk1-ENV): New.
+
+ [BZ #1079]
+ * include/stdlib.h: Remove malloc attribute from __posix_memalign.
+ * stdlib/stdlib.h: Likewise.
+
+2005-07-15 Ulrich Drepper <drepper@redhat.com>
+
+ * wcsmbs/bits/wchar2.h: New file.
+ * include/bits/wchar2.h: New file.
+ * wcsmbs/wchar.h: Include <bits/wchar2.h> if fortification is
+ requested.
+ * wcsmbs/wcsncpy.c: Add __wcsncpy alias.
+ * string/bits/string3.h: Add fortified stpncpy definitions.
+ * sysdeps/generic/stpncpy_chk.c: New file.
+ * libio/vswprintf.c: Move _IO_wstrnfile definition to strfile.h.
+ Export _IO_wstrn_jumps.
+ * libio/strfile.h: Define _IO_wstrnfile and declare _IO_wstrn_jumps.
+ * include/wchar.h: Declare __wcsncpy and __vswprintf_chk.
+ * debug/fgetws_chk.c: New file.
+ * debug/fgetws_u_chk.c: New file.
+ * debug/fwprintf_chk.c: New file.
+ * debug/swprintf_chk.c: New file.
+ * debug/vfwprintf_chk.c: New file.
+ * debug/vswprintf_chk.c: New file.
+ * debug/vwprintf_chk.c: New file.
+ * debug/wcpcpy_chk.c: New file.
+ * debug/wcpncpy_chk.c: New file.
+ * debug/wcscat_chk.c: New file.
+ * debug/wcscpy_chk.c: New file.
+ * debug/wcsncat_chk.c: New file.
+ * debug/wcsncpy_chk.c: New file.
+ * debug/wmemcpy_chk.c: New file.
+ * debug/wmemmove_chk.c: New file.
+ * debug/wmempcpy_chk.c: New file.
+ * debug/wmemset_chk.c: New file.
+ * debug/wprintf_chk.c: New file.
+ * debug/tst-chk1.c: Add tests for new functions.
+ * debug/Versions: Export new functions.
+ * debug/Makefile (routines): Add new functions.
+
+2005-07-13 Ulrich Drepper <drepper@redhat.com>
+
+ * nscd/nscd_helper.c: Add a few __builtin_expect.
+
+ [BZ #1080]
+ * nscd/connections.c (send_ro_fd): Make sure BUF is aligned correctly.
+ * nscd/nscd_helper.c (wait_on_socket): New function.
+ (get_mapping): Use wait_on_socket instead of poll. The former handles
+ EINTR of poll correctly.
+ (__nscd_open_socket): Likewise.
+ (get_mapping): Make sure BUF is aligned correctly.
+ (get_mapping): Use munmap on correct pointer.
+
+2005-07-12 Ulrich Drepper <drepper@redhat.com>
+
+ * include/libc-symbols.h: Define macros for librt hidden symbols.
+ * include/time.h: Add librt_hidden_proto definition for clock_gettime.
+ * sysdeps/generic/clock_gettime.c: Add librt_hidden_def.
+ * sysdeps/unix/clock_gettime.c: Likewise.
+
+ * stdlib/bits/stdlib.h: New file.
+ * stdlib/stdlib.h: Include <bits/stdlib.h> if fortification is
+ requested.
+ * Makefile (headers): Add bits/stdlib.h.
+ * include/bits/stdlib.h: New file.
+ * debug/Depend: New file.
+ * debug/ptsname_r_chk.c: New file.
+ * debug/realpath_chk.c: New file.
+ * debug/wctomb_chk.c: New file.
+ * debug/Makefile (routines): Add ptsname_r_chk, realpath_chk, and
+ wctomb_chk.
+ * debug/Versions: Export __ptsname_r_chk, __realpath_chk, and
+ __wctomb_chk.
+ * debug/tst-chk1.c: Add tests for __ptsname_r_chk, __realpath_chk, and
+ __wctomb_chk.
+
+2005-07-12 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #1106]
+ * sysdeps/unix/sysv/linux/ia64/has_cpuclock.c: Include not-cancel.h.
+ (has_cpuclock): Use open_not_cancel_2 instead of open, read_not_cancel
+ instead of read and close_not_cancel_no_status instead of close.
+
+ [BZ #1106]
+ * sysdeps/s390/s390-64/bcopy.S (__bcopy): Use
+ HIDDEN_BUILTIN_JUMPTARGET to jump to memmove.
+
+2005-06-27 Carlos O'Donell <carlos@systemhalted.org>
+
+ * posix/regcomp.c (re_compile_internal): Call __libc_lock_init
+ after init_dfa.
+
+2005-07-08 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/x86_64/fpu/s_sincosl.S: Use retq not ret. Remove
+ alignment.
+ * sysdeps/x86_64/fpu/s_sincos.S: New file.
+
+ * include/fenv.h: Add libm_hidden_proto for fesetround and
+ feholdexcept.
+ * sysdeps/alpha/fpu/feholdexcpt.c: Add libm_hidden_def.
+ * sysdeps/alpha/fpu/fesetround.c: Likewise.
+ * sysdeps/generic/feholdexcpt.c: Likewise.
+ * sysdeps/generic/fesetround.c: Likewise.
+ * sysdeps/i386/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/i386/fpu/fesetround.c: Likewise.
+ * sysdeps/ia64/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/ia64/fpu/fesetround.c: Likewise.
+ * sysdeps/powerpc/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/powerpc/fpu/fesetround.c: Likewise.
+ * sysdeps/s390/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/s390/fpu/fesetround.c: Likewise.
+ * sysdeps/sh/sh4/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/sh/sh4/fpu/fesetround.c: Likewise.
+ * sysdeps/sparc/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/sparc/fpu/fesetround.c: Likewise.
+ * sysdeps/x86_64/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/x86_64/fpu/fesetround.c: Likewise.
+ * sysdeps/generic/s_significand.c (__significand): Use __ilogb not
+ ilogb.
+ * sysdeps/generic/s_significandf.c (__significandf): Use __ilogbf
+ not ilogbf.
+ * sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Use __sin and
+ __cos, not sin and cos.
+
2005-07-07 Ulrich Drepper <drepper@redhat.com>
* resolv/res_send.c (send_dg): Recognize referral results and
@@ -86,6 +364,7 @@
2005-07-05 Thorsten Kukuk <kukuk@suse.de>
+ [BZ #1111]
* nis/nss_compat/compat-grp.c (internal_getgrgid_r): Check if NSS
module provides getgrgid_r.
(getgrnam_plusgroup): Preserve original return value.
@@ -95,6 +374,7 @@
2005-07-05 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1101]
* posix/regex_internal.c (build_wcs_buffer): Use MB_LEN_MAX not
MB_CUR_MAX.
(build_wcs_upper_buffer): Likewise.
@@ -129,11 +409,13 @@
2005-06-23 Thorsten Kukuk <kukuk@suse.de>
+ [BZ #1109]
* nscd/nscd_stat.c (receive_print_stats): Replace YESSTR/NOSTR
with own translation.
2005-06-25 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1097]
* sunrpc/xdr.c (xdr_hyper, xdr_u_hyper): When decoding, cast
t2 to uint32_t instead of ulong.
* sunrpc/Makefile (tests): Add tst-xdrmem.
@@ -185,6 +467,7 @@
2005-06-20 Jakub Jelinek <jakub@redhat.com>
+ [BZ #653]
* sysdeps/unix/sysv/linux/sys/quota.h: Add definitions and types for
_LINUX_QUOTA_VERSION >= 2.
(_LINUX_QUOTA_VERSION): Define if not yet defined.
@@ -204,9 +487,11 @@
2005-06-17 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1106]
* time/mktime.c: Always include <string.h> for prototype of
implicitly used memcpy.
+ [BZ #1104]
* sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
(truncate64): Use __truncate, not truncate.
(__have_no_truncate64): Renamed from have_no_truncate64.
@@ -280,6 +565,7 @@
2005-06-17 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1106]
* sysdeps/posix/sigignore.c: Include <string.h> to tell the compiler
to use __GI_memset.
* sysdeps/posix/signal.c: Likewise.
@@ -291,12 +577,14 @@
2005-06-15 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1088]
* hesiod/hesiod.c (hesiod_init): Don't check for ctx->classes[0] == 0
or both classes equal here.
(parse_config_file): If both classes are equal, clear the second one.
2005-06-08 Karl Kelley <kekelley@iastate.edu>
+ [BZ #1088]
* hesiod/hesiod_p.h (struct hesiod_p): Add classes array.
* hesiod/hesiod.c (hesiod_init): Initialize classes. Fail if no
valid classes were given or if both are equal.
@@ -307,6 +595,7 @@
2005-06-14 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1085]
* configure.in: Add test for availability of libaudit.
* config.h.in: Define HAVE_LIBAUDIT.
* config.make.in: Define have-libaudit.
@@ -339,6 +628,7 @@
2005-06-13 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1096]
* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_sendreq,
__netlink_receive): Remove prototypes.
(__netlink_request): New prototype.
@@ -547,6 +837,7 @@
2005-05-23 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1086]
* sunrpc/bindrsvprt.c (LOWPORT): Apparently some mountd
implementations are broken and don't accept ports < 512.
@@ -558,6 +849,7 @@
2005-05-23 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1086]
* sunrpc/pm_getport.c (__get_socket): New function.
(pmap_getport): Use it to open a non-reserved socket to the portmapper
for TCP.
@@ -566,6 +858,7 @@
non-reserved socket for the portmapper.
Based on a patch by Steve Dickson <steved@redhat.com>.
+ [BZ #1086]
* sunrpc/bindrsvprt.c (bindresvport): Try harder to find a port.
If we tried looking at the usual range without success extend the
range to even lower ports.
@@ -831,6 +1124,7 @@
2005-04-29 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1083]
* sysdeps/posix/posix_fallocate.c (posix_fallocate): If len == 0,
call ftruncate if offset is bigger than current size. Make sure
the file is offset + len bytes long if that is more than current size.
@@ -854,6 +1148,7 @@
2005-04-29 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1093]
* nis/nis_table.c: Fix realloc handling.
* nis/nis_removemember.c: Likewise.
@@ -935,6 +1230,7 @@
2005-04-27 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1094]
* nscd/connections.c (nscd_run): Use time() value in prune_cache
call, not timeout value, since the latter might be from another clock.
@@ -1004,6 +1300,7 @@
2005-04-26 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1105]
* time/strptime_l.c (__strptime_internal): Handle 'z' to set
tm_gmtoff.
* time/Makefile (tests): Add tst-strptime2.
@@ -1011,6 +1308,7 @@
2005-04-26 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1081]
* elf/dl-close.c: Include stddef.h.
(_dl_close): If called recursively, just remember GC needs to be rerun
and decrease l_direct_opencount. Avoid GC if l_direct_opencount
@@ -1037,6 +1335,7 @@
2005-04-26 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1110]
* stdio-common/vfscanf.c: Correctly account for characters of
decimal points right after +-.
@@ -1056,6 +1355,7 @@
2005-04-24 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1110]
* stdio-common/vfscanf.c: Fix parsing of decimal point after +-.
Patch by Hamed Malek <hamed@bamdad.org>.
@@ -1136,6 +1436,7 @@
2005-04-12 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1090]
* stdlib/random_r.c (__initstate_r): Don't use non-existing state.
* string/tst-strfry.c: New file.
* string/Makefile (tests): Add tst-strfry.
@@ -1315,6 +1616,7 @@
2005-04-04 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1082]
* sunrpc/pmap_rmt.c (xdr_rmtcall_args): Use a dummy arglen instead
of trying to encode uninitialized arglen.
@@ -1519,6 +1821,7 @@
2005-03-29 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1087]
* posix/fnmatch.c (fnmatch): For short patterns or strings attempt to
avoid calling mbsrtowcs twice.
@@ -1675,6 +1978,7 @@
2005-03-21 Thorsten Kukuk <kukuk@suse.de>
+ [BZ #1098]
* sunrpc/xdr_stdio.c (xdrstdio_getlong, xdrstdio_putlong):
Convert correctly between long/int on 64bit big-endian.
@@ -1731,7 +2035,7 @@
2005-02-27 Denis Barbier <barbier@debian.org>
- [BZ #38]
+ [BZ #549]
* locale/iso-4217.def: Add CSD currency.
2005-03-19 Ulrich Drepper <drepper@redhat.com>
@@ -2031,6 +2335,7 @@
* iconv/gconv_simple.c (internal_utf8_loop): Make start unsigned
to avoid warning.
+ [BZ #1101]
* posix/regex_internal.c [_LIBC] (build_wcs_buffer): Avoid using
dynamically sized array.
(build_wcs_upper_buffer): Likewise.
@@ -2298,12 +2603,14 @@
2005-02-22 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1095]
* malloc/Makefile (CFLAGS-mcheck-init.c): Add.
* sunrpc/Makefile: Add $(PIC-ccflag) to CFLAGS-x* for
librpcsvc.a objects.
2005-02-21 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1107]
* iconvdata/ibm930.h: Correct Yen mapping.
* iconvdata/ibm939.h: Likewise.
* iconvdata/testdata/IBM930..UTF8: Adjust test data.
@@ -2602,6 +2909,7 @@
2005-02-11 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1100]
* debug/chk_fail.c (__chk_fail): Add a while (1) loop around
__libc_message to kill GCC warning about noreturn function returning.
@@ -2839,6 +3147,7 @@
2005-01-30 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1103]
* nscd/nscd_helper.c (get_mapping): Use MSG_NOSIGNAL if available.
* nscd/connections.c (send_ro_fd): Likewise.
@@ -2967,6 +3276,7 @@
2005-01-26 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1100]
* debug/chk_fail.c (__chk_fail): Print program name in final message.
* sysdeps/unix/sysv/linux/kernel-features.h: Found reference to
@@ -2994,6 +3304,7 @@
2005-01-14 GOTO Masanori <gotom@debian.or.jp>
+ [BZ #1108]
* sunrpc/rpc_main.c (s_output): Generate #include <rpc/pmap_clnt.h>
irrespective of Cflag.
@@ -3218,6 +3529,7 @@
as backlog.
* sunrpc/svc_unix.c (svcunix_create): Likewise.
+ [BZ #1099]
* grp/putgrent.c (putgrent): Don't write 0 as group
ID if groupname starts with + or -.
* pwd/putpwent.c (putpwent): Don't write 0 as user or
diff --git a/Makerules b/Makerules
index 63b07a2..e95d310 100644
--- a/Makerules
+++ b/Makerules
@@ -1390,7 +1390,7 @@ objs-for-stubs := $(foreach o,$(object-suffixes-for-libc),$(o-objects)) \
$(addprefix $(objpfx),$(extra-objs))
$(objpfx)stubs: $(objs-for-stubs)
ifneq (,$(strip $(objs-for-stubs)))
- $(OBJDUMP) -h $^ | \
+ (cd $(objdir); $(OBJDUMP) -h $(patsubst $(objpfx)%,%,$^)) | \
$(AWK) '/\.gnu\.glibc-stub\./ { \
sub(/\.gnu\.glibc-stub\./, "", $$2); \
stubs[$$2] = 1; } \
diff --git a/argp/argp-fmtstream.c b/argp/argp-fmtstream.c
index 215160bd..1004e67 100644
--- a/argp/argp-fmtstream.c
+++ b/argp/argp-fmtstream.c
@@ -1,5 +1,5 @@
/* Word-wrapping and line-truncating streams
- Copyright (C) 1997,1998,1999,2001,2002,2003 Free Software Foundation, Inc.
+ Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -102,11 +102,10 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
if (fs->p > fs->buf)
{
#ifdef USE_IN_LIBIO
- if (_IO_fwide (fs->stream, 0) > 0)
- __fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf);
- else
+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
+#else
+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
#endif
- fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
}
free (fs->buf);
free (fs);
@@ -291,17 +290,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
else
/* Output the first line so we can use the space. */
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (fs->stream, 0) > 0)
- __fwprintf (fs->stream, L"%.*s\n",
- (int) (nl - fs->buf), fs->buf);
- else
+#ifdef _LIBC
+ __fxprintf (fs->stream, "%.*s\n",
+ (int) (nl - fs->buf), fs->buf);
+#else
+ if (nl > fs->buf)
+ fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
+ putc_unlocked ('\n', fs->stream);
#endif
- {
- if (nl > fs->buf)
- fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
- putc_unlocked ('\n', fs->stream);
- }
+
len += buf - fs->buf;
nl = buf = fs->buf;
}
@@ -360,15 +357,12 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
/* Flush FS's buffer. */
__argp_fmtstream_update (fs);
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (fs->stream, 0) > 0)
- {
- __fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf);
- wrote = fs->p - fs->buf;
- }
- else
+#ifdef _LIBC
+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
+ wrote = fs->p - fs->buf;
+#else
+ wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
#endif
- wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
if (wrote == fs->p - fs->buf)
{
fs->p = fs->buf;
diff --git a/argp/argp-help.c b/argp/argp-help.c
index 6701870..ee61ed4 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing help output
- Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -1763,33 +1763,26 @@ __argp_error (const struct argp_state *state, const char *fmt, ...)
va_start (ap, fmt);
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stream, 0) > 0)
- {
- char *buf;
+#ifdef _LIBC
+ char *buf;
- if (__asprintf (&buf, fmt, ap) < 0)
- buf = NULL;
+ if (__asprintf (&buf, fmt, ap) < 0)
+ buf = NULL;
- __fwprintf (stream, L"%s: %s\n",
- state ? state->name : __argp_short_program_name (),
- buf);
+ __fxprintf (stream, "%s: %s\n",
+ state ? state->name : __argp_short_program_name (), buf);
- free (buf);
- }
- else
-#endif
- {
- fputs_unlocked (state
- ? state->name : __argp_short_program_name (),
- stream);
- putc_unlocked (':', stream);
- putc_unlocked (' ', stream);
+ free (buf);
+#else
+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
+ stream);
+ putc_unlocked (':', stream);
+ putc_unlocked (' ', stream);
- vfprintf (stream, fmt, ap);
+ vfprintf (stream, fmt, ap);
- putc_unlocked ('\n', stream);
- }
+ putc_unlocked ('\n', stream);
+#endif
__argp_state_help (state, stream, ARGP_HELP_STD_ERR);
@@ -1827,41 +1820,34 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
__flockfile (stream);
#endif
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stream, 0) > 0)
- __fwprintf (stream, L"%s",
- state ? state->name : __argp_short_program_name ());
- else
+#ifdef _LIBC
+ __fxprintf (stream, "%s",
+ state ? state->name : __argp_short_program_name ());
+#else
+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
+ stream);
#endif
- fputs_unlocked (state
- ? state->name : __argp_short_program_name (),
- stream);
if (fmt)
{
va_list ap;
va_start (ap, fmt);
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stream, 0) > 0)
- {
- char *buf;
+#ifdef _LIBC
+ char *buf;
- if (__asprintf (&buf, fmt, ap) < 0)
- buf = NULL;
+ if (__asprintf (&buf, fmt, ap) < 0)
+ buf = NULL;
- __fwprintf (stream, L": %s", buf);
+ __fxprintf (stream, ": %s", buf);
- free (buf);
- }
- else
-#endif
- {
- putc_unlocked (':', stream);
- putc_unlocked (' ', stream);
+ free (buf);
+#else
+ putc_unlocked (':', stream);
+ putc_unlocked (' ', stream);
- vfprintf (stream, fmt, ap);
- }
+ vfprintf (stream, fmt, ap);
+#endif
va_end (ap);
}
@@ -1870,21 +1856,18 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
{
char buf[200];
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stream, 0) > 0)
- __fwprintf (stream, L": %s",
- __strerror_r (errnum, buf, sizeof (buf)));
- else
-#endif
- {
- putc_unlocked (':', stream);
- putc_unlocked (' ', stream);
-#if defined _LIBC || defined HAVE_STRERROR_R
- fputs (__strerror_r (errnum, buf, sizeof (buf)), stream);
+#ifdef _LIBC
+ __fxprintf (stream, ": %s",
+ __strerror_r (errnum, buf, sizeof (buf)));
#else
- fputs (strerror (errnum), stream);
+ putc_unlocked (':', stream);
+ putc_unlocked (' ', stream);
+# ifdef HAVE_STRERROR_R
+ fputs (__strerror_r (errnum, buf, sizeof (buf)), stream);
+# else
+ fputs (strerror (errnum), stream);
+# endif
#endif
- }
}
#ifdef USE_IN_LIBIO
diff --git a/assert/assert-perr.c b/assert/assert-perr.c
index 3017c9f..dd54246 100644
--- a/assert/assert-perr.c
+++ b/assert/assert-perr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-1998,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1994-1998,2001,2002,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -61,13 +61,7 @@ __assert_perror_fail (int errnum,
__strerror_r (errnum, errbuf, sizeof errbuf)) >= 0)
{
/* Print the message. */
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", buf);
- else
-#endif
- (void) fputs (buf, stderr);
-
+ (void) __fxprintf (NULL, "%s", buf);
(void) fflush (stderr);
/* We have to free the buffer since the appplication might catch the
diff --git a/assert/assert.c b/assert/assert.c
index 20c86eb..0ef4ca6 100644
--- a/assert/assert.c
+++ b/assert/assert.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1994-1996,1998,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1994-1996,1998,2001,2002,2005
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -60,13 +61,7 @@ __assert_fail (const char *assertion, const char *file, unsigned int line,
assertion) >= 0)
{
/* Print the message. */
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", buf);
- else
-#endif
- (void) fputs (buf, stderr);
-
+ (void) __fxprintf (NULL, "%s", buf);
(void) fflush (stderr);
/* We have to free the buffer since the application might catch the
diff --git a/config.make.in b/config.make.in
index 1ab4bfb..3687507 100644
--- a/config.make.in
+++ b/config.make.in
@@ -58,6 +58,7 @@ have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@
enable-check-abi = @enable_check_abi@
have-forced-unwind = @libc_cv_forced_unwind@
have-fpie = @libc_cv_fpie@
+have-ssp = @libc_cv_ssp@
have-selinux = @have_selinux@
have-libaudit = @have_libaudit@
have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
diff --git a/configure b/configure
index 402da46..a449415 100755
--- a/configure
+++ b/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -5799,6 +5799,33 @@ if test $libc_cv_fno_unit_at_a_time = yes; then
fi
+echo "$as_me:$LINENO: checking for -fstack-protector" >&5
+echo $ECHO_N "checking for -fstack-protector... $ECHO_C" >&6
+if test "${libc_cv_ssp+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fstack-protector
+ -o conftest conftest.c 1>&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+then
+ libc_cv_ssp=yes
+else
+ libc_cv_ssp=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_ssp" >&5
+echo "${ECHO_T}$libc_cv_ssp" >&6
+
+
if test $elf != yes; then
echo "$as_me:$LINENO: checking for .init and .fini sections" >&5
echo $ECHO_N "checking for .init and .fini sections... $ECHO_C" >&6
@@ -8434,6 +8461,7 @@ s,@libc_cv_z_combreloc@,$libc_cv_z_combreloc,;t t
s,@libc_cv_z_execstack@,$libc_cv_z_execstack,;t t
s,@libc_cv_fpie@,$libc_cv_fpie,;t t
s,@fno_unit_at_a_time@,$fno_unit_at_a_time,;t t
+s,@libc_cv_ssp@,$libc_cv_ssp,;t t
s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t
s,@no_whole_archive@,$no_whole_archive,;t t
s,@exceptions@,$exceptions,;t t
diff --git a/configure.in b/configure.in
index 4396891..21756e0 100644
--- a/configure.in
+++ b/configure.in
@@ -1508,6 +1508,21 @@ if test $libc_cv_fno_unit_at_a_time = yes; then
fi
AC_SUBST(fno_unit_at_a_time)
+AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
+cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fstack-protector
+ -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+ libc_cv_ssp=yes
+else
+ libc_cv_ssp=no
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_ssp)
+
if test $elf != yes; then
AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
[AC_TRY_COMPILE(, [asm (".section .init");
diff --git a/debug/Depend b/debug/Depend
new file mode 100644
index 0000000..f3e1156
--- /dev/null
+++ b/debug/Depend
@@ -0,0 +1 @@
+localedata
diff --git a/debug/Makefile b/debug/Makefile
index 6ec08dc..009c05c 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -26,12 +26,21 @@ distribute = sigcontextinfo.h register-dump.h frame.h
routines = backtrace backtracesyms backtracesymsfd noophooks \
memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
- strcat_chk strcpy_chk strncat_chk strncpy_chk \
+ strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
printf_chk fprintf_chk vprintf_chk vfprintf_chk \
gets_chk chk_fail readonly-area fgets_chk fgets_u_chk \
read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
- readlink_chk getwd_chk getcwd_chk stack_chk_fail \
+ readlink_chk getwd_chk getcwd_chk realpath_chk ptsname_r_chk \
+ wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
+ wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
+ wcpncpy_chk \
+ swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
+ vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
+ confstr_chk getgroups_chk ttyname_r_chk getlogin_r_chk \
+ gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
+ wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk \
+ stack_chk_fail \
$(static-only-routines)
static-only-routines := warning-nop stack_chk_fail_local
@@ -47,12 +56,27 @@ CFLAGS-vfprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
CFLAGS-gets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
CFLAGS-fgets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
CFLAGS-fgets_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-swprintf_chk.c = -D_IO_MTSAFE_IO
+CFLAGS-vswprintf_chk.c = -D_IO_MTSAFE_IO
+CFLAGS-wprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-fwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-vwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-vfwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-fgetws_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-fgetws_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
CFLAGS-read_chk.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread_chk.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread64_chk.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-recv_chk.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-recvfrom_chk.c = -fexceptions -fasynchronous-unwind-tables
+tst-chk1-ENV = LOCPATH=$(common-objpfx)localedata
+tst-chk2-ENV = LOCPATH=$(common-objpfx)localedata
+tst-chk3-ENV = LOCPATH=$(common-objpfx)localedata
+tst-lfschk1-ENV = LOCPATH=$(common-objpfx)localedata
+tst-lfschk2-ENV = LOCPATH=$(common-objpfx)localedata
+tst-lfschk3-ENV = LOCPATH=$(common-objpfx)localedata
+
tests = backtrace-tst tst-chk1 tst-chk2 tst-chk3 \
tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk
diff --git a/debug/Versions b/debug/Versions
index 051f4df..2f4183b 100644
--- a/debug/Versions
+++ b/debug/Versions
@@ -23,6 +23,15 @@ libc {
__read_chk; __pread_chk; __pread64_chk;
__readlink_chk; __getcwd_chk; __getwd_chk;
__recv_chk; __recvfrom_chk;
+ __realpath_chk; __ptsname_r_chk; __wctomb_chk;
+ __stpncpy_chk;
+ __wcscpy_chk; __wmemcpy_chk; __wmemmove_chk; __wmempcpy_chk; __wcpcpy_chk;
+ __wcsncpy_chk; __wcscat_chk; __wcsncat_chk; __wmemset_chk; __wcpncpy_chk;
+ __swprintf_chk; __vswprintf_chk; __wprintf_chk; __fwprintf_chk;
+ __vwprintf_chk; __vfwprintf_chk; __fgetws_chk; __fgetws_unlocked_chk;
+ __confstr_chk; __getgroups_chk; __ttyname_r_chk; __getlogin_r_chk;
+ __gethostname_chk; __getdomainname_chk; __wcrtomb_chk; __mbsnrtowcs_chk;
+ __wcsnrtombs_chk; __mbsrtowcs_chk; __wcsrtombs_chk;
__stack_chk_fail;
}
diff --git a/debug/confstr_chk.c b/debug/confstr_chk.c
new file mode 100644
index 0000000..dae7714
--- /dev/null
+++ b/debug/confstr_chk.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@readhat.com>, 20055.
+
+ 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 <unistd.h>
+
+
+size_t
+__confstr_chk (int name, char *buf, size_t len, size_t buflen)
+{
+ if (__builtin_expect (buflen < len, 0))
+ __chk_fail ();
+
+ return confstr (name, buf, len);
+}
diff --git a/debug/fgetws_chk.c b/debug/fgetws_chk.c
new file mode 100644
index 0000000..d080ccb
--- /dev/null
+++ b/debug/fgetws_chk.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 "libioP.h"
+#include <wchar.h>
+#include <sys/param.h>
+
+wchar_t *
+__fgetws_chk (wchar_t *buf, size_t size, int n, _IO_FILE *fp)
+{
+ _IO_size_t count;
+ wchar_t *result;
+ int old_error;
+ CHECK_FILE (fp, NULL);
+ if (n <= 0)
+ return NULL;
+ _IO_acquire_lock (fp);
+ /* This is very tricky since a file descriptor may be in the
+ non-blocking mode. The error flag doesn't mean much in this
+ case. We return an error only when there is a new error. */
+ old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
+ fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+ count = _IO_getwline (fp, buf, MIN ((size_t) n - 1, size), L'\n', 1);
+ /* If we read in some bytes and errno is EAGAIN, that error will
+ be reported for next read. */
+ if (count == 0 || (_IO_ferror_unlocked (fp) && errno != EAGAIN))
+ result = NULL;
+ else if (count >= size)
+ __chk_fail ();
+ else
+ {
+ buf[count] = '\0';
+ result = buf;
+ }
+ fp->_IO_file_flags |= old_error;
+ _IO_release_lock (fp);
+ return result;
+}
diff --git a/debug/fgetws_u_chk.c b/debug/fgetws_u_chk.c
new file mode 100644
index 0000000..b6cc87b
--- /dev/null
+++ b/debug/fgetws_u_chk.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1993, 95, 96, 97, 98, 99, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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.
+
+ As a special exception, if you link the code in this file with
+ files compiled with a GNU compiler to produce an executable,
+ that does not cause the resulting executable to be covered by
+ the GNU Lesser General Public License. This exception does not
+ however invalidate any other reasons why the executable file
+ might be covered by the GNU Lesser General Public License.
+ This exception applies to code released by its copyright holders
+ in files containing the exception. */
+
+#include "libioP.h"
+#include <wchar.h>
+#include <sys/param.h>
+
+wchar_t *
+__fgetws_unlocked_chk (wchar_t *buf, size_t size, int n, _IO_FILE *fp)
+{
+ _IO_size_t count;
+ wchar_t *result;
+ int old_error;
+ CHECK_FILE (fp, NULL);
+ if (n <= 0)
+ return NULL;
+ /* This is very tricky since a file descriptor may be in the
+ non-blocking mode. The error flag doesn't mean much in this
+ case. We return an error only when there is a new error. */
+ old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
+ fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+ count = _IO_getwline (fp, buf, MIN ((size_t) n - 1, size), L'\n', 1);
+ /* If we read in some bytes and errno is EAGAIN, that error will
+ be reported for next read. */
+ if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
+ && errno != EAGAIN))
+ result = NULL;
+ else if (count >= size)
+ __chk_fail ();
+ else
+ {
+ buf[count] = '\0';
+ result = buf;
+ }
+ fp->_IO_file_flags |= old_error;
+ return result;
+}
diff --git a/debug/fwprintf_chk.c b/debug/fwprintf_chk.c
new file mode 100644
index 0000000..710c89f
--- /dev/null
+++ b/debug/fwprintf_chk.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <stdarg.h>
+#include <wchar.h>
+#include "../libio/libioP.h"
+
+
+/* Write formatted output to FP from the format string FORMAT. */
+int
+__fwprintf_chk (FILE *fp, int flag, const wchar_t *format, ...)
+{
+ va_list ap;
+ int done;
+
+ _IO_acquire_lock (fp);
+ if (flag > 0)
+ fp->_flags2 |= _IO_FLAGS2_FORTIFY;
+
+ va_start (ap, format);
+ done = _IO_vfwprintf (fp, format, ap);
+ va_end (ap);
+
+ if (flag > 0)
+ fp->_flags2 &= ~_IO_FLAGS2_FORTIFY;
+ _IO_release_lock (fp);
+
+ return done;
+}
diff --git a/debug/getdomainname_chk.c b/debug/getdomainname_chk.c
new file mode 100644
index 0000000..a854645
--- /dev/null
+++ b/debug/getdomainname_chk.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <unistd.h>
+
+
+int
+__getdomainname_chk (char *buf, size_t buflen, size_t nreal)
+{
+ if (buflen > nreal)
+ __chk_fail ();
+
+ return getdomainname (buf, buflen);
+}
diff --git a/debug/getgroups_chk.c b/debug/getgroups_chk.c
new file mode 100644
index 0000000..6401b02
--- /dev/null
+++ b/debug/getgroups_chk.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <unistd.h>
+
+
+char *
+__getgroups_chk (int size, __gid_t list[], size_t listlen)
+{
+ if (__builtin_expect (size * sizeof (__gid_t) > listlen, 0))
+ __chk_fail ();
+
+ return __getgroups (size, list);
+}
diff --git a/debug/gethostname_chk.c b/debug/gethostname_chk.c
new file mode 100644
index 0000000..734cc56
--- /dev/null
+++ b/debug/gethostname_chk.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <unistd.h>
+
+
+int
+__gethostname_chk (char *buf, size_t buflen, size_t nreal)
+{
+ if (buflen > nreal)
+ __chk_fail ();
+
+ return __gethostname (buf, buflen);
+}
diff --git a/debug/getlogin_r_chk.c b/debug/getlogin_r_chk.c
new file mode 100644
index 0000000..ae495cd
--- /dev/null
+++ b/debug/getlogin_r_chk.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <unistd.h>
+
+
+int
+__getlogin_r_chk (char *buf, size_t buflen, size_t nreal)
+{
+ if (buflen > nreal)
+ __chk_fail ();
+
+ return getlogin_r (buf, buflen);
+}
diff --git a/debug/mbsnrtowcs_chk.c b/debug/mbsnrtowcs_chk.c
new file mode 100644
index 0000000..2041eac
--- /dev/null
+++ b/debug/mbsnrtowcs_chk.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <locale.h>
+#include <wchar.h>
+
+
+size_t
+__mbsnrtowcs_chk (wchar_t *dst, __const char **src, size_t nmc, size_t len,
+ mbstate_t *ps, size_t dstlen)
+{
+ if (__builtin_expect (dstlen < len * sizeof (wchar_t), 0))
+ __chk_fail ();
+
+ return __mbsnrtowcs (dst, src, nmc, len, ps);
+}
diff --git a/debug/mbsrtowcs_chk.c b/debug/mbsrtowcs_chk.c
new file mode 100644
index 0000000..fd4b3bf
--- /dev/null
+++ b/debug/mbsrtowcs_chk.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <locale.h>
+#include <wchar.h>
+
+
+size_t
+__mbsrtowcs_chk (wchar_t *dst, __const char **src, size_t len,
+ mbstate_t *ps, size_t dstlen)
+{
+ if (__builtin_expect (dstlen < len * sizeof (wchar_t), 0))
+ __chk_fail ();
+
+ return __mbsrtowcs (dst, src, len, ps);
+}
diff --git a/debug/ptsname_r_chk.c b/debug/ptsname_r_chk.c
new file mode 100644
index 0000000..5f03592
--- /dev/null
+++ b/debug/ptsname_r_chk.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <stdlib.h>
+
+
+int
+__ptsname_r_chk (int fd, char *buf, size_t buflen, size_t nreal)
+{
+ if (buflen > nreal)
+ __chk_fail ();
+
+ return __ptsname_r (fd, buf, buflen);
+}
diff --git a/debug/realpath_chk.c b/debug/realpath_chk.c
new file mode 100644
index 0000000..961aea0
--- /dev/null
+++ b/debug/realpath_chk.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+char *
+__realpath_chk (const char *buf, char *resolved, size_t resolvedlen)
+{
+#ifdef PATH_MAX
+ if (resolvedlen < PATH_MAX)
+ __chk_fail ();
+
+ return __realpath (buf, resolved);
+#else
+ long int pathmax =__pathconf (buf, _PC_PATH_MAX);
+ if (pathmax != -1)
+ {
+ /* We do have a fixed limit. */
+ if (resolvedlen < pathmax)
+ __chk_fail ();
+
+ return __realpath (buf, resolved);
+ }
+
+ /* Since there is no fixed limit we check whether the size is large
+ enough. */
+ char *res = __realpath (buf, NULL);
+ if (res != NULL)
+ {
+ size_t actlen = strlen (res) + 1;
+ if (actlen > resolvedlen)
+ __chk_fail ();
+
+ memcpy (resolved, res, actlen);
+ free (res);
+ res = resolved;
+ }
+
+ return res;
+#endif
+}
diff --git a/debug/swprintf_chk.c b/debug/swprintf_chk.c
new file mode 100644
index 0000000..554cbe6
--- /dev/null
+++ b/debug/swprintf_chk.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,1995,1997,1998,1999,2000,2003,2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <stdarg.h>
+#include <wchar.h>
+
+/* Write formatted output into S, according to the format string FORMAT. */
+/* VARARGS5 */
+int
+__swprintf_chk (wchar_t *s, size_t n, int flag, size_t s_len,
+ const wchar_t *format, ...)
+{
+ va_list arg;
+ int done;
+
+ va_start (arg, format);
+ done = __vswprintf_chk (s, n, flag, s_len, format, arg);
+ va_end (arg);
+
+ return done;
+}
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
index dca41ab..f444a14 100644
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -21,15 +21,17 @@
#define __noreturn__
#include <fcntl.h>
+#include <locale.h>
#include <paths.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <unistd.h>
char *temp_filename;
static void do_prepare (void);
@@ -74,13 +76,20 @@ handler (int sig)
}
char buf[10];
+wchar_t wbuf[10];
volatile size_t l0;
volatile char *p;
+volatile wchar_t *wp;
const char *str1 = "JIHGFEDCBA";
const char *str2 = "F";
const char *str3 = "%s%n%s%n";
const char *str4 = "Hello, ";
const char *str5 = "World!\n";
+const wchar_t *wstr1 = L"JIHGFEDCBA";
+const wchar_t *wstr2 = L"F";
+const wchar_t *wstr3 = L"%s%n%s%n";
+const wchar_t *wstr4 = L"Hello, ";
+const wchar_t *wstr5 = L"World!\n";
char buf2[10] = "%s";
int num1 = 67;
int num2 = 987654;
@@ -125,6 +134,7 @@ do_test (void)
setenv ("LIBC_FATAL_STDERR_", "1", 1);
struct A { char buf1[9]; char buf2[1]; } a;
+ struct wA { wchar_t buf1[9]; wchar_t buf2[1]; } wa;
printf ("Test checking routines at fortify level %d\n",
#ifdef __USE_FORTIFY_LEVEL
@@ -140,7 +150,8 @@ do_test (void)
if (memcmp (buf, "aabcdefghi", 10))
FAIL ();
- if (mempcpy (buf + 5, "abcde", 5) != buf + 10 || memcmp (buf, "aabcdabcde", 10))
+ if (mempcpy (buf + 5, "abcde", 5) != buf + 10
+ || memcmp (buf, "aabcdabcde", 10))
FAIL ();
memset (buf + 8, 'j', 2);
@@ -171,7 +182,8 @@ do_test (void)
if (memcmp (buf, "aabcdefghi", 10))
FAIL ();
- if (mempcpy (buf + 5, "abcde", l0 + 5) != buf + 10 || memcmp (buf, "aabcdabcde", 10))
+ if (mempcpy (buf + 5, "abcde", l0 + 5) != buf + 10
+ || memcmp (buf, "aabcdabcde", 10))
FAIL ();
memset (buf + 8, 'j', l0 + 2);
@@ -189,20 +201,24 @@ do_test (void)
if (memcmp (buf, "aabcEDX\0\0", 10))
FAIL ();
- if (sprintf (buf + 7, "%d", num1) != 2 || memcmp (buf, "aabcEDX67", 10))
+ if (stpncpy (buf + 5, "cd", l0 + 5) != buf + 7
+ || memcmp (buf, "aabcEcd\0\0", 10))
+ FAIL ();
+
+ if (sprintf (buf + 7, "%d", num1) != 2 || memcmp (buf, "aabcEcd67", 10))
FAIL ();
- if (snprintf (buf + 7, 3, "%d", num2) != 6 || memcmp (buf, "aabcEDX98", 10))
+ if (snprintf (buf + 7, 3, "%d", num2) != 6 || memcmp (buf, "aabcEcd98", 10))
FAIL ();
buf[l0 + 8] = '\0';
strcat (buf, "A");
- if (memcmp (buf, "aabcEDX9A", 10))
+ if (memcmp (buf, "aabcEcd9A", 10))
FAIL ();
buf[l0 + 7] = '\0';
strncat (buf, "ZYXWV", l0 + 2);
- if (memcmp (buf, "aabcEDXZY", 10))
+ if (memcmp (buf, "aabcEcdZY", 10))
FAIL ();
memcpy (a.buf1, "abcdefghij", l0 + 10);
@@ -226,14 +242,16 @@ do_test (void)
if (memcmp (a.buf1, "aabcEDCBA", 10))
FAIL ();
- if (stpcpy (a.buf1 + 8, str2) != a.buf1 + 9 || memcmp (a.buf1, "aabcEDCBF", 10))
+ if (stpcpy (a.buf1 + 8, str2) != a.buf1 + 9
+ || memcmp (a.buf1, "aabcEDCBF", 10))
FAIL ();
strncpy (a.buf1 + 6, "X", l0 + 4);
if (memcmp (a.buf1, "aabcEDX\0\0", 10))
FAIL ();
- if (sprintf (a.buf1 + 7, "%d", num1) != 2 || memcmp (a.buf1, "aabcEDX67", 10))
+ if (sprintf (a.buf1 + 7, "%d", num1) != 2
+ || memcmp (a.buf1, "aabcEDX67", 10))
FAIL ();
if (snprintf (a.buf1 + 7, 3, "%d", num2) != 6
@@ -284,6 +302,10 @@ do_test (void)
CHK_FAIL_END
CHK_FAIL_START
+ stpncpy (buf + 6, "cd", l0 + 5);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
sprintf (buf + 8, "%d", num1);
CHK_FAIL_END
@@ -354,6 +376,215 @@ do_test (void)
CHK_FAIL_END
#endif
+
+ /* These ops can be done without runtime checking of object size. */
+ wmemcpy (wbuf, L"abcdefghij", 10);
+ wmemmove (wbuf + 1, wbuf, 9);
+ if (wmemcmp (wbuf, L"aabcdefghi", 10))
+ FAIL ();
+
+ if (wmempcpy (wbuf + 5, L"abcde", 5) != wbuf + 10
+ || wmemcmp (wbuf, L"aabcdabcde", 10))
+ FAIL ();
+
+ wmemset (wbuf + 8, L'j', 2);
+ if (wmemcmp (wbuf, L"aabcdabcjj", 10))
+ FAIL ();
+
+ wcscpy (wbuf + 4, L"EDCBA");
+ if (wmemcmp (wbuf, L"aabcEDCBA", 10))
+ FAIL ();
+
+ if (wcpcpy (wbuf + 8, L"F") != wbuf + 9 || wmemcmp (wbuf, L"aabcEDCBF", 10))
+ FAIL ();
+
+ wcsncpy (wbuf + 6, L"X", 4);
+ if (wmemcmp (wbuf, L"aabcEDX\0\0", 10))
+ FAIL ();
+
+ if (swprintf (wbuf + 7, 3, L"%ls", L"987654") >= 0
+ || wmemcmp (wbuf, L"aabcEDX98", 10))
+ FAIL ();
+
+ /* These ops need runtime checking, but shouldn't __chk_fail. */
+ wmemcpy (wbuf, L"abcdefghij", l0 + 10);
+ wmemmove (wbuf + 1, wbuf, l0 + 9);
+ if (wmemcmp (wbuf, L"aabcdefghi", 10))
+ FAIL ();
+
+ if (wmempcpy (wbuf + 5, L"abcde", l0 + 5) != wbuf + 10
+ || wmemcmp (wbuf, L"aabcdabcde", 10))
+ FAIL ();
+
+ wmemset (wbuf + 8, L'j', l0 + 2);
+ if (wmemcmp (wbuf, L"aabcdabcjj", 10))
+ FAIL ();
+
+ wcscpy (wbuf + 4, wstr1 + 5);
+ if (wmemcmp (wbuf, L"aabcEDCBA", 10))
+ FAIL ();
+
+ if (wcpcpy (wbuf + 8, wstr2) != wbuf + 9 || wmemcmp (wbuf, L"aabcEDCBF", 10))
+ FAIL ();
+
+ wcsncpy (wbuf + 6, L"X", l0 + 4);
+ if (wmemcmp (wbuf, L"aabcEDX\0\0", 10))
+ FAIL ();
+
+ if (wcpncpy (wbuf + 5, L"cd", l0 + 5) != wbuf + 7
+ || wmemcmp (wbuf, L"aabcEcd\0\0", 10))
+ FAIL ();
+
+ if (swprintf (wbuf + 7, 3, L"%d", num2) >= 0
+ || wmemcmp (wbuf, L"aabcEcd98", 10))
+ FAIL ();
+
+ wbuf[l0 + 8] = L'\0';
+ wcscat (wbuf, L"A");
+ if (wmemcmp (wbuf, L"aabcEcd9A", 10))
+ FAIL ();
+
+ wbuf[l0 + 7] = L'\0';
+ wcsncat (wbuf, L"ZYXWV", l0 + 2);
+ if (wmemcmp (wbuf, L"aabcEcdZY", 10))
+ FAIL ();
+
+ wmemcpy (wa.buf1, L"abcdefghij", l0 + 10);
+ wmemmove (wa.buf1 + 1, wa.buf1, l0 + 9);
+ if (wmemcmp (wa.buf1, L"aabcdefghi", 10))
+ FAIL ();
+
+ if (wmempcpy (wa.buf1 + 5, L"abcde", l0 + 5) != wa.buf1 + 10
+ || wmemcmp (wa.buf1, L"aabcdabcde", 10))
+ FAIL ();
+
+ wmemset (wa.buf1 + 8, L'j', l0 + 2);
+ if (wmemcmp (wa.buf1, L"aabcdabcjj", 10))
+ FAIL ();
+
+#if __USE_FORTIFY_LEVEL < 2
+ /* The following tests are supposed to crash with -D_FORTIFY_SOURCE=2
+ and sufficient GCC support, as the string operations overflow
+ from a.buf1 into a.buf2. */
+ wcscpy (wa.buf1 + 4, wstr1 + 5);
+ if (wmemcmp (wa.buf1, L"aabcEDCBA", 10))
+ FAIL ();
+
+ if (wcpcpy (wa.buf1 + 8, wstr2) != wa.buf1 + 9
+ || wmemcmp (wa.buf1, L"aabcEDCBF", 10))
+ FAIL ();
+
+ wcsncpy (wa.buf1 + 6, L"X", l0 + 4);
+ if (wmemcmp (wa.buf1, L"aabcEDX\0\0", 10))
+ FAIL ();
+
+ if (swprintf (wa.buf1 + 7, 3, L"%d", num2) >= 0
+ || wmemcmp (wa.buf1, L"aabcEDX98", 10))
+ FAIL ();
+
+ wa.buf1[l0 + 8] = L'\0';
+ wcscat (wa.buf1, L"A");
+ if (wmemcmp (wa.buf1, L"aabcEDX9A", 10))
+ FAIL ();
+
+ wa.buf1[l0 + 7] = L'\0';
+ wcsncat (wa.buf1, L"ZYXWV", l0 + 2);
+ if (wmemcmp (wa.buf1, L"aabcEDXZY", 10))
+ FAIL ();
+
+#endif
+
+#if __USE_FORTIFY_LEVEL >= 1
+ /* Now check if all buffer overflows are caught at runtime. */
+
+ CHK_FAIL_START
+ wmemcpy (wbuf + 1, L"abcdefghij", l0 + 10);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wmemmove (wbuf + 2, wbuf + 1, l0 + 9);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wp = wmempcpy (wbuf + 6, L"abcde", l0 + 5);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wmemset (wbuf + 9, L'j', l0 + 2);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wcscpy (wbuf + 5, wstr1 + 5);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wp = wcpcpy (wbuf + 9, wstr2);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wcsncpy (wbuf + 7, L"X", l0 + 4);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wcpncpy (wbuf + 6, L"cd", l0 + 5);
+ CHK_FAIL_END
+
+ wmemcpy (wbuf, wstr1 + 2, l0 + 9);
+ CHK_FAIL_START
+ wcscat (wbuf, L"AB");
+ CHK_FAIL_END
+
+ wmemcpy (wbuf, wstr1 + 3, l0 + 8);
+ CHK_FAIL_START
+ wcsncat (wbuf, L"ZYXWV", l0 + 3);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wmemcpy (wa.buf1 + 1, L"abcdefghij", l0 + 10);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wmemmove (wa.buf1 + 2, wa.buf1 + 1, l0 + 9);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wp = wmempcpy (wa.buf1 + 6, L"abcde", l0 + 5);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wmemset (wa.buf1 + 9, L'j', l0 + 2);
+ CHK_FAIL_END
+
+#if __USE_FORTIFY_LEVEL >= 2
+# define O 0
+#else
+# define O 1
+#endif
+
+ CHK_FAIL_START
+ wcscpy (wa.buf1 + (O + 4), wstr1 + 5);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wp = wcpcpy (wa.buf1 + (O + 8), wstr2);
+ CHK_FAIL_END
+
+ CHK_FAIL_START
+ wcsncpy (wa.buf1 + (O + 6), L"X", l0 + 4);
+ CHK_FAIL_END
+
+ wmemcpy (wa.buf1, wstr1 + (3 - O), l0 + 8 + O);
+ CHK_FAIL_START
+ wcscat (wa.buf1, L"AB");
+ CHK_FAIL_END
+
+ wmemcpy (wa.buf1, wstr1 + (4 - O), l0 + 7 + O);
+ CHK_FAIL_START
+ wcsncat (wa.buf1, L"ZYXWV", l0 + 3);
+ CHK_FAIL_END
+#endif
+
+
/* Now checks for %n protection. */
/* Constant literals passed directly are always ok
@@ -794,5 +1025,236 @@ do_test (void)
if (rmdir (fname) != 0)
FAIL ();
+
+#if PATH_MAX > 0
+ char largebuf[PATH_MAX];
+ char *realres = realpath (".", largebuf);
+#endif
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char realbuf[1];
+ realres = realpath (".", realbuf);
+ CHK_FAIL_END
+#endif
+
+ if (setlocale (LC_ALL, "de_DE.UTF-8") != NULL)
+ {
+ /* First a simple test. */
+ char enough[MB_CUR_MAX];
+ if (wctomb (enough, L'A') != 1)
+ {
+ puts ("first wctomb test failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ /* We know the wchar_t encoding is ISO 10646. So pick a
+ character which has a multibyte representation which does not
+ fit. */
+ CHK_FAIL_START
+ char smallbuf[2];
+ if (wctomb (smallbuf, L'\x100') != 2)
+ {
+ puts ("second wctomb test failed");
+ ret = 1;
+ }
+ CHK_FAIL_END
+#endif
+
+ mbstate_t s;
+ memset (&s, '\0', sizeof (s));
+ if (wcrtomb (enough, L'A', &s) != 1)
+ {
+ puts ("first wcrtomb test failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ /* We know the wchar_t encoding is ISO 10646. So pick a
+ character which has a multibyte representation which does not
+ fit. */
+ CHK_FAIL_START
+ char smallbuf[2];
+ if (wcrtomb (smallbuf, L'\x100', &s) != 2)
+ {
+ puts ("second wcrtomb test failed");
+ ret = 1;
+ }
+ CHK_FAIL_END
+#endif
+
+ wchar_t wenough[10];
+ memset (&s, '\0', sizeof (s));
+ const char *cp = "A";
+ if (mbsrtowcs (wenough, &cp, 10, &s) != 1)
+ {
+ puts ("first mbsrtowcs test failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ /* We know the wchar_t encoding is ISO 10646. So pick a
+ character which has a multibyte representation which does not
+ fit. */
+ CHK_FAIL_START
+ wchar_t wsmallbuf[2];
+ cp = "ABC";
+ mbsrtowcs (wsmallbuf, &cp, 10, &s);
+ CHK_FAIL_END
+#endif
+
+ memset (&s, '\0', sizeof (s));
+ cp = "A";
+ if (mbsnrtowcs (wenough, &cp, 1, 10, &s) != 1)
+ {
+ puts ("first mbsnrtowcs test failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ /* We know the wchar_t encoding is ISO 10646. So pick a
+ character which has a multibyte representation which does not
+ fit. */
+ CHK_FAIL_START
+ wchar_t wsmallbuf[2];
+ cp = "ABC";
+ mbsnrtowcs (wsmallbuf, &cp, 3, 10, &s);
+ CHK_FAIL_END
+#endif
+
+ memset (&s, '\0', sizeof (s));
+ const wchar_t *wcp = L"A";
+ if (wcsrtombs (enough, &wcp, 10, &s) != 1)
+ {
+ puts ("first wcsrtombs test failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ /* We know the wchar_t encoding is ISO 10646. So pick a
+ character which has a multibyte representation which does not
+ fit. */
+ CHK_FAIL_START
+ char smallbuf[2];
+ wcp = L"ABC";
+ wcsrtombs (smallbuf, &wcp, 10, &s);
+ CHK_FAIL_END
+#endif
+
+ memset (&s, '\0', sizeof (s));
+ wcp = L"A";
+ if (wcsnrtombs (enough, &wcp, 1, 10, &s) != 1)
+ {
+ puts ("first wcsnrtombs test failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ /* We know the wchar_t encoding is ISO 10646. So pick a
+ character which has a multibyte representation which does not
+ fit. */
+ CHK_FAIL_START
+ char smallbuf[2];
+ wcp = L"ABC";
+ wcsnrtombs (smallbuf, &wcp, 3, 10, &s);
+ CHK_FAIL_END
+#endif
+ }
+ else
+ {
+ puts ("cannot set locale");
+ ret = 1;
+ }
+
+ fd = posix_openpt (O_RDWR);
+ if (fd != -1)
+ {
+ char enough[1000];
+ if (ptsname_r (fd, enough, sizeof (enough)) != 0)
+ {
+ puts ("first ptsname_r failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char smallbuf[2];
+ if (ptsname_r (fd, smallbuf, sizeof (smallbuf) + 1) == 0)
+ {
+ puts ("second ptsname_r somehow suceeded");
+ ret = 1;
+ }
+ CHK_FAIL_END
+#endif
+ close (fd);
+ }
+
+ confstr (_CS_GNU_LIBC_VERSION, largebuf, sizeof (largebuf));
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char smallbuf[1];
+ confstr (_CS_GNU_LIBC_VERSION, smallbuf, sizeof (largebuf));
+ CHK_FAIL_END
+#endif
+
+ gid_t grpslarge[5];
+ int ngr = getgroups (5, grpslarge);
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char smallbuf[1];
+ ngr = getgroups (5, (gid_t *) smallbuf);
+ CHK_FAIL_END
+#endif
+
+ fd = open (_PATH_TTY, O_RDONLY);
+ if (fd != -1)
+ {
+ char enough[1000];
+ if (ttyname_r (fd, enough, sizeof (enough)) != 0)
+ {
+ puts ("first ttyname_r failed");
+ ret = 1;
+ }
+
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char smallbuf[2];
+ if (ttyname_r (fd, smallbuf, sizeof (smallbuf) + 1) == 0)
+ {
+ puts ("second ttyname_r somehow suceeded");
+ ret = 1;
+ }
+ CHK_FAIL_END
+#endif
+ close (fd);
+ }
+
+ char hostnamelarge[1000];
+ gethostname (hostnamelarge, sizeof (hostnamelarge));
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char smallbuf[1];
+ gethostname (smallbuf, sizeof (hostnamelarge));
+ CHK_FAIL_END
+#endif
+
+ char loginlarge[1000];
+ getlogin_r (loginlarge, sizeof (hostnamelarge));
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char smallbuf[1];
+ getlogin_r (smallbuf, sizeof (loginlarge));
+ CHK_FAIL_END
+#endif
+
+ char domainnamelarge[1000];
+ int res = getdomainname (domainnamelarge, sizeof (domainnamelarge));
+#if __USE_FORTIFY_LEVEL >= 1
+ CHK_FAIL_START
+ char smallbuf[1];
+ res = getdomainname (smallbuf, sizeof (domainnamelarge));
+ CHK_FAIL_END
+#endif
+
return ret;
}
diff --git a/debug/ttyname_r_chk.c b/debug/ttyname_r_chk.c
new file mode 100644
index 0000000..9b06d5a
--- /dev/null
+++ b/debug/ttyname_r_chk.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <unistd.h>
+
+
+int
+__ttyname_r_chk (int fd, char *buf, size_t buflen, size_t nreal)
+{
+ if (buflen > nreal)
+ __chk_fail ();
+
+ return __ttyname_r (fd, buf, buflen);
+}
diff --git a/debug/vfwprintf_chk.c b/debug/vfwprintf_chk.c
new file mode 100644
index 0000000..d4af557
--- /dev/null
+++ b/debug/vfwprintf_chk.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <stdarg.h>
+#include <wchar.h>
+#include "../libio/libioP.h"
+
+
+/* Write formatted output to FP from the format string FORMAT. */
+int
+__vfwprintf_chk (FILE *fp, int flag, const wchar_t *format, va_list ap)
+{
+ int done;
+
+ _IO_acquire_lock (fp);
+ if (flag > 0)
+ fp->_flags2 |= _IO_FLAGS2_FORTIFY;
+
+ done = _IO_vfwprintf (fp, format, ap);
+
+ if (flag > 0)
+ fp->_flags2 &= ~_IO_FLAGS2_FORTIFY;
+ _IO_release_lock (fp);
+
+ return done;
+}
diff --git a/debug/vswprintf_chk.c b/debug/vswprintf_chk.c
new file mode 100644
index 0000000..f9a50c6
--- /dev/null
+++ b/debug/vswprintf_chk.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 1991,1995,1997,1998,2004,2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <stdarg.h>
+#include <wchar.h>
+#include "../libio/libioP.h"
+#include "../libio/strfile.h"
+
+
+/* Write formatted output into S, according to the format
+ string FORMAT, writing no more than MAXLEN characters. */
+/* VARARGS5 */
+int
+__vswprintf_chk (wchar_t *s, size_t maxlen, int flags, size_t slen,
+ const wchar_t *format, va_list args)
+{
+ /* XXX Maybe for less strict version do not fail immediately.
+ Though, maxlen is supposed to be the size of buffer pointed
+ to by s, so a conforming program can't pass such maxlen
+ to *snprintf. */
+ if (__builtin_expect (slen < maxlen, 0))
+ __chk_fail ();
+
+ _IO_wstrnfile sf;
+ struct _IO_wide_data wd;
+ int ret;
+#ifdef _IO_MTSAFE_IO
+ sf.f._sbf._f._lock = NULL;
+#endif
+
+ /* We need to handle the special case where MAXLEN is 0. Use the
+ overflow buffer right from the start. */
+ if (__builtin_expect (maxlen == 0, 0))
+ /* Since we have to write at least the terminating L'\0' a buffer
+ length of zero always makes the function fail. */
+ return -1;
+
+ _IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, 0, &wd, &_IO_wstrn_jumps);
+ _IO_fwide (&sf.f._sbf._f, 1);
+ s[0] = L'\0';
+
+ /* For flags > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
+ can only come from read-only format strings. */
+ if (flags > 0)
+ sf.f._sbf._f._flags2 |= _IO_FLAGS2_FORTIFY;
+
+ _IO_wstr_init_static (&sf.f._sbf._f, s, maxlen - 1, s);
+ ret = _IO_vfwprintf ((_IO_FILE *) &sf.f._sbf, format, args);
+
+ if (sf.f._sbf._f._wide_data->_IO_buf_base == sf.overflow_buf)
+ /* ISO C99 requires swprintf/vswprintf to return an error if the
+ output does not fit int he provided buffer. */
+ return -1;
+
+ /* Terminate the string. */
+ *sf.f._sbf._f._wide_data->_IO_write_ptr = '\0';
+
+ return ret;
+}
+libc_hidden_def (__vswprintf_chk)
diff --git a/debug/vwprintf_chk.c b/debug/vwprintf_chk.c
new file mode 100644
index 0000000..3b959b2
--- /dev/null
+++ b/debug/vwprintf_chk.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <stdarg.h>
+#include <stdio.h>
+#include <wchar.h>
+#include "../libio/libioP.h"
+
+
+/* Write formatted output to stdout from the format string FORMAT. */
+int
+__vwprintf_chk (int flag, const wchar_t *format, va_list ap)
+{
+ int done;
+
+ _IO_acquire_lock (stdout);
+ if (flag > 0)
+ stdout->_flags2 |= _IO_FLAGS2_FORTIFY;
+
+ done = _IO_vfwprintf (stdout, format, ap);
+
+ if (flag > 0)
+ stdout->_flags2 &= ~_IO_FLAGS2_FORTIFY;
+ _IO_release_lock (stdout);
+
+ return done;
+}
diff --git a/debug/wcpcpy_chk.c b/debug/wcpcpy_chk.c
new file mode 100644
index 0000000..c48ec68
--- /dev/null
+++ b/debug/wcpcpy_chk.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+
+ 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 <wchar.h>
+
+#define __need_ptrdiff_t
+#include <stddef.h>
+
+
+/* Copy SRC to DEST, returning the address of the terminating L'\0' in
+ DEST. Check for overflows. */
+wchar_t *
+__wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen)
+{
+ wchar_t *wcp = (wchar_t *) dest - 1;
+ wint_t c;
+ const ptrdiff_t off = src - dest + 1;
+
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = wcp[off];
+ *++wcp = c;
+ }
+ while (c != L'\0');
+
+ return wcp;
+}
diff --git a/debug/wcpncpy_chk.c b/debug/wcpncpy_chk.c
new file mode 100644
index 0000000..ea13401
--- /dev/null
+++ b/debug/wcpncpy_chk.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1995, 1996, 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ 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 <wchar.h>
+
+
+/* Copy no more than N wide-characters of SRC to DEST. */
+wchar_t *
+__wcpncpy_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
+{
+ if (__builtin_expect (destlen < n, 0))
+ __chk_fail ();
+
+ /* This function is not often enough used to justify not using a
+ tail call. */
+ return __wcpncpy (dest, src, n);
+}
diff --git a/debug/wcrtomb_chk.c b/debug/wcrtomb_chk.c
new file mode 100644
index 0000000..228430f
--- /dev/null
+++ b/debug/wcrtomb_chk.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <langinfo.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <locale/localeinfo.h>
+
+
+size_t
+__wcrtomb_chk (char *s, wchar_t wchar, mbstate_t *ps, size_t buflen)
+{
+ /* We do not have to implement the full wctomb semantics since we
+ know that S cannot be NULL when we come here. */
+ if (buflen < MB_CUR_MAX)
+ __chk_fail ();
+
+ return __wcrtomb (s, wchar, ps);
+}
diff --git a/debug/wcscat_chk.c b/debug/wcscat_chk.c
new file mode 100644
index 0000000..eef0451
--- /dev/null
+++ b/debug/wcscat_chk.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 1995, 1996, 1997, 2001, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ 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 <wchar.h>
+
+
+/* Append SRC on the end of DEST. Check for overflows. */
+wchar_t *
+__wcscat_chk (wchar_t *dest, const wchar_t *src, size_t destlen)
+{
+ register wchar_t *s1 = dest;
+ register const wchar_t *s2 = src;
+ wchar_t c;
+
+ /* Find the end of the string. */
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *s1++;
+ }
+ while (c != L'\0');
+
+ /* Make S1 point before the next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ s1 -= 2;
+ ++destlen;
+
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *s2++;
+ *++s1 = c;
+ }
+ while (c != L'\0');
+
+ return dest;
+}
diff --git a/debug/wcscpy_chk.c b/debug/wcscpy_chk.c
new file mode 100644
index 0000000..93b78cd
--- /dev/null
+++ b/debug/wcscpy_chk.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1995, 1996, 1997, 2003, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ 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 <stddef.h>
+#include <wchar.h>
+
+
+/* Copy SRC to DEST. */
+wchar_t *
+__wcscpy_chk (wchar_t *dest, const wchar_t *src, size_t n)
+{
+ wint_t c;
+ wchar_t *wcp;
+
+ if (__alignof__ (wchar_t) >= sizeof (wchar_t))
+ {
+ const ptrdiff_t off = dest - src - 1;
+
+ wcp = (wchar_t *) src;
+
+ do
+ {
+ if (__builtin_expect (n-- == 0, 0))
+ __chk_fail ();
+ c = *wcp++;
+ wcp[off] = c;
+ }
+ while (c != L'\0');
+ }
+ else
+ {
+ wcp = dest;
+
+ do
+ {
+ if (__builtin_expect (n-- == 0, 0))
+ __chk_fail ();
+ c = *src++;
+ *wcp++ = c;
+ }
+ while (c != L'\0');
+ }
+
+ return dest;
+}
diff --git a/debug/wcsncat_chk.c b/debug/wcsncat_chk.c
new file mode 100644
index 0000000..b28773f
--- /dev/null
+++ b/debug/wcsncat_chk.c
@@ -0,0 +1,96 @@
+/* Copyright (C) 1995, 1996, 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ 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 <wchar.h>
+
+
+/* Append no more than N wide-character of SRC onto DEST. */
+wchar_t *
+__wcsncat_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
+{
+ wchar_t c;
+ wchar_t * const s = dest;
+
+ /* Find the end of DEST. */
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *dest++;
+ }
+ while (c != L'\0');
+
+ /* Make DEST point before next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ ++destlen;
+ dest -= 2;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *src++;
+ *++dest = c;
+ if (c == L'\0')
+ return s;
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *src++;
+ *++dest = c;
+ if (c == L'\0')
+ return s;
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *src++;
+ *++dest = c;
+ if (c == L'\0')
+ return s;
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *src++;
+ *++dest = c;
+ if (c == L'\0')
+ return s;
+ } while (--n4 > 0);
+ n &= 3;
+ }
+
+ while (n > 0)
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *src++;
+ *++dest = c;
+ if (c == L'\0')
+ return s;
+ n--;
+ }
+
+ if (c != L'\0')
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ *++dest = L'\0';
+ }
+
+ return s;
+}
diff --git a/debug/wcsncpy_chk.c b/debug/wcsncpy_chk.c
new file mode 100644
index 0000000..199e4b0
--- /dev/null
+++ b/debug/wcsncpy_chk.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1995, 1996, 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ 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 <wchar.h>
+
+
+/* Copy no more than N wide-characters of SRC to DEST. */
+wchar_t *
+__wcsncpy_chk (wchar_t *dest, const wchar_t *src, size_t n, size_t destlen)
+{
+ if (__builtin_expect (destlen < n, 0))
+ __chk_fail ();
+
+ /* This function is not often enough used to justify not using a
+ tail call. */
+ return __wcsncpy (dest, src, n);
+}
diff --git a/debug/wcsnrtombs_chk.c b/debug/wcsnrtombs_chk.c
new file mode 100644
index 0000000..67644bd
--- /dev/null
+++ b/debug/wcsnrtombs_chk.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <locale.h>
+#include <wchar.h>
+
+
+size_t
+__wcsnrtombs_chk (char *dst, __const wchar_t **src, size_t nwc, size_t len,
+ mbstate_t *ps, size_t dstlen)
+{
+ if (__builtin_expect (dstlen < len, 0))
+ __chk_fail ();
+
+ return __wcsnrtombs (dst, src, nwc, len, ps);
+}
diff --git a/debug/wcsrtombs_chk.c b/debug/wcsrtombs_chk.c
new file mode 100644
index 0000000..9334267
--- /dev/null
+++ b/debug/wcsrtombs_chk.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <locale.h>
+#include <wchar.h>
+
+
+size_t
+__wcsrtombs_chk (char *dst, __const wchar_t **src, size_t len,
+ mbstate_t *ps, size_t dstlen)
+{
+ if (__builtin_expect (dstlen < len, 0))
+ __chk_fail ();
+
+ return __wcsrtombs (dst, src, len, ps);
+}
diff --git a/debug/wctomb_chk.c b/debug/wctomb_chk.c
new file mode 100644
index 0000000..d036634
--- /dev/null
+++ b/debug/wctomb_chk.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <locale.h>
+#include <stdlib.h>
+#include <wcsmbs/wcsmbsload.h>
+
+
+extern mbstate_t __no_r_state attribute_hidden; /* Defined in mbtowc.c. */
+
+
+int
+__wctomb_chk (char *s, wchar_t wchar, size_t buflen)
+{
+ /* We do not have to implement the full wctomb semantics since we
+ know that S cannot be NULL when we come here. */
+ if (buflen < MB_CUR_MAX)
+ __chk_fail ();
+
+ return __wcrtomb (s, wchar, &__no_r_state);
+}
diff --git a/debug/wmemcpy_chk.c b/debug/wmemcpy_chk.c
new file mode 100644
index 0000000..eeee927
--- /dev/null
+++ b/debug/wmemcpy_chk.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996, 1997, 1999, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
+
+ 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 <wchar.h>
+#include <string.h>
+
+
+wchar_t *
+__wmemcpy_chk (wchar_t *s1, const wchar_t *s2, size_t n, size_t ns1)
+{
+ if (__builtin_expect (ns1 < n, 0))
+ __chk_fail ();
+ return (wchar_t *) memcpy ((char *) s1, (char *) s2, n * sizeof (wchar_t));
+}
diff --git a/debug/wmemmove_chk.c b/debug/wmemmove_chk.c
new file mode 100644
index 0000000..da0446e
--- /dev/null
+++ b/debug/wmemmove_chk.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996, 1997, 1999, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
+
+ 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 <wchar.h>
+#include <string.h>
+
+
+wchar_t *
+__wmemmove_chk (wchar_t *s1, const wchar_t *s2, size_t n, size_t ns1)
+{
+ if (__builtin_expect (ns1 < n, 0))
+ __chk_fail ();
+ return (wchar_t *) memmove ((char *) s1, (char *) s2, n * sizeof (wchar_t));
+}
diff --git a/debug/wmempcpy_chk.c b/debug/wmempcpy_chk.c
new file mode 100644
index 0000000..52c629a
--- /dev/null
+++ b/debug/wmempcpy_chk.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1999, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
+
+ 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 <wchar.h>
+#include <string.h>
+
+
+wchar_t *
+__wmempcpy_chk (wchar_t *s1, const wchar_t *s2, size_t n, size_t ns1)
+{
+ if (__builtin_expect (ns1 < n, 0))
+ __chk_fail ();
+ return (wchar_t *) __mempcpy ((char *) s1, (char *) s2,
+ n * sizeof (wchar_t));
+}
diff --git a/debug/wmemset_chk.c b/debug/wmemset_chk.c
new file mode 100644
index 0000000..5ed88e8
--- /dev/null
+++ b/debug/wmemset_chk.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996,97,99,2002,2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
+
+ 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 <wchar.h>
+
+
+wchar_t *
+__wmemset_chk (wchar_t *s, wchar_t c, size_t n, size_t dstlen)
+{
+ if (__builtin_expect (dstlen < n, 0))
+ __chk_fail ();
+
+ return wmemset (s, c, n);
+}
diff --git a/debug/wprintf_chk.c b/debug/wprintf_chk.c
new file mode 100644
index 0000000..e0a8261
--- /dev/null
+++ b/debug/wprintf_chk.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004, 2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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 <stdarg.h>
+#include <stdio.h>
+#include <wchar.h>
+#include "../libio/libioP.h"
+
+
+/* Write formatted output to stdout from the format string FORMAT. */
+int
+__wprintf_chk (int flag, const wchar_t *format, ...)
+{
+ va_list ap;
+ int done;
+
+ _IO_acquire_lock (stdout);
+ if (flag > 0)
+ stdout->_flags2 |= _IO_FLAGS2_FORTIFY;
+
+ va_start (ap, format);
+ done = _IO_vfwprintf (stdout, format, ap);
+ va_end (ap);
+
+ if (flag > 0)
+ stdout->_flags2 &= ~_IO_FLAGS2_FORTIFY;
+ _IO_release_lock (stdout);
+
+ return done;
+}
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 7aea6ca..c001682 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -1,5 +1,5 @@
# This file is updated automatically by Makefile.
glibc-branch := fedora
glibc-base := HEAD
-fedora-sync-date := 2005-07-08 08:11 UTC
-fedora-sync-tag := fedora-glibc-20050708T0811
+fedora-sync-date := 2005-07-21 08:14 UTC
+fedora-sync-tag := fedora-glibc-20050721T0814
diff --git a/gmon/gmon.c b/gmon/gmon.c
index 8eb0736..d292454 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -331,7 +331,7 @@ write_gmon (void)
{
size_t len = strlen (env);
char buf[len + 20];
- sprintf (buf, "%s.%u", env, __getpid ());
+ snprintf (buf, sizeof (buf), "%s.%u", env, __getpid ());
fd = open_not_cancel (buf, O_CREAT|O_TRUNC|O_WRONLY|O_NOFOLLOW, 0666);
}
@@ -343,14 +343,8 @@ write_gmon (void)
{
char buf[300];
int errnum = errno;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"_mcleanup: gmon.out: %s\n",
- __strerror_r (errnum, buf, sizeof buf));
- else
-#endif
- fprintf (stderr, "_mcleanup: gmon.out: %s\n",
- __strerror_r (errnum, buf, sizeof buf));
+ __fxprintf (NULL, "_mcleanup: gmon.out: %s\n",
+ __strerror_r (errnum, buf, sizeof buf));
return;
}
}
diff --git a/include/bits/stdlib.h b/include/bits/stdlib.h
new file mode 100644
index 0000000..8541e27
--- /dev/null
+++ b/include/bits/stdlib.h
@@ -0,0 +1 @@
+#include <stdlib/bits/stdlib.h>
diff --git a/include/bits/wchar2.h b/include/bits/wchar2.h
new file mode 100644
index 0000000..a18dccf
--- /dev/null
+++ b/include/bits/wchar2.h
@@ -0,0 +1 @@
+#include <wcsmbs/bits/wchar2.h>
diff --git a/include/fenv.h b/include/fenv.h
index 2063091..673eb4b 100644
--- a/include/fenv.h
+++ b/include/fenv.h
@@ -13,5 +13,7 @@ extern int __feupdateenv (__const fenv_t *__envp);
libm_hidden_proto (feraiseexcept)
libm_hidden_proto (fesetenv)
+libm_hidden_proto (fesetround)
+libm_hidden_proto (feholdexcept)
#endif
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index cdbc4ef..4fef305 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -708,6 +708,24 @@ for linking")
# define libresolv_hidden_data_ver(local, name)
#endif
+#if defined NOT_IN_libc && defined IS_IN_librt
+# define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define librt_hidden_def(name) hidden_def (name)
+# define librt_hidden_weak(name) hidden_weak (name)
+# define librt_hidden_ver(local, name) hidden_ver (local, name)
+# define librt_hidden_data_def(name) hidden_data_def (name)
+# define librt_hidden_data_weak(name) hidden_data_weak (name)
+# define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
+#else
+# define librt_hidden_proto(name, attrs...)
+# define librt_hidden_def(name)
+# define librt_hidden_weak(name)
+# define librt_hidden_ver(local, name)
+# define librt_hidden_data_def(name)
+# define librt_hidden_data_weak(name)
+# define librt_hidden_data_ver(local, name)
+#endif
+
#if defined NOT_IN_libc && defined IS_IN_libdl
# define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libdl_hidden_def(name) hidden_def (name)
diff --git a/include/stdio.h b/include/stdio.h
index c8c89ad..9220db5 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -79,6 +79,8 @@ extern int __ftrylockfile (FILE *__stream);
extern int __getc_unlocked (FILE *__fp);
extern wint_t __getwc_unlocked (FILE *__fp);
+extern int __fxprintf (FILE *__fp, const char *__fmt, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
extern __const char *__const _sys_errlist_internal[] attribute_hidden;
extern int _sys_nerr_internal attribute_hidden;
diff --git a/include/stdlib.h b/include/stdlib.h
index 7723bf6..49e8757 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -95,8 +95,8 @@ extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d)
extern void __cxa_finalize (void *d);
-extern int __posix_memalign (void **memptr, size_t alignment, size_t size)
- __attribute_malloc__;
+extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
+
extern void *__libc_memalign (size_t alignment, size_t size)
__attribute_malloc__;
diff --git a/include/time.h b/include/time.h
index 795eb5f..3d8fef8 100644
--- a/include/time.h
+++ b/include/time.h
@@ -17,6 +17,8 @@ libc_hidden_proto (localtime)
libc_hidden_proto (strftime)
libc_hidden_proto (strptime)
+librt_hidden_proto (clock_gettime)
+
/* Now define the internal interfaces. */
struct tm;
diff --git a/include/wchar.h b/include/wchar.h
index 0f91114..e8079e6 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -82,6 +82,8 @@ extern size_t __wcsnrtombs (char *__restrict __dst,
__const wchar_t **__restrict __src,
size_t __nwc, size_t __len,
__mbstate_t *__restrict __ps);
+extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src, size_t __n);
extern wchar_t *__wcpcpy (wchar_t *__dest, __const wchar_t *__src);
extern wchar_t *__wcpncpy (wchar_t *__dest, __const wchar_t *__src,
size_t __n);
@@ -112,6 +114,13 @@ extern int __vfwprintf (__FILE *__restrict __s,
/* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
+ int __flag, size_t __s_len,
+ __const wchar_t *__restrict __format,
+ __gnuc_va_list __arg)
+ /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
+libc_hidden_proto (__vswprintf_chk)
+
/* Internal functions. */
extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
mbstate_t *ps, __locale_t l) attribute_hidden;
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 0bcb731..da6c070 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -137,21 +137,13 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
(void)__snprintf(num, sizeof(num), "%d", ntohs(rport));
error = getaddrinfo(*ahost, num, &hints, &res);
if (error) {
- if (error == EAI_NONAME && *ahost != NULL) {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s: Unknown host\n",
- *ahost);
- else
- fprintf(stderr, "%s: Unknown host\n", *ahost);
- } else {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"rcmd: getaddrinfo: %s\n",
- gai_strerror(error));
- else
- fprintf(stderr, "rcmd: getaddrinfo: %s\n",
- gai_strerror(error));
- }
- return (-1);
+ if (error == EAI_NONAME && *ahost != NULL)
+ __fxprintf(NULL, "%s: Unknown host\n", *ahost);
+ else
+ __fxprintf(NULL, "rcmd: getaddrinfo: %s\n",
+ gai_strerror(error));
+
+ return -1;
}
pfd[0].events = POLLIN;
@@ -161,13 +153,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
free (ahostbuf);
ahostbuf = strdup (res->ai_canonname);
if (ahostbuf == NULL) {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s",
- _("rcmd: Cannot allocate memory\n"));
- else
- fputs(_("rcmd: Cannot allocate memory\n"),
- stderr);
- return (-1);
+ __fxprintf(NULL, "%s",
+ _("rcmd: Cannot allocate memory\n"));
+ return -1;
}
*ahost = ahostbuf;
} else
@@ -180,20 +168,12 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
s = rresvport_af(&lport, ai->ai_family);
if (s < 0) {
- if (errno == EAGAIN) {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s",
- _("rcmd: socket: All ports in use\n"));
- else
- fputs(_("rcmd: socket: All ports in use\n"),
- stderr);
- } else {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr,
- L"rcmd: socket: %m\n");
- else
- fprintf(stderr, "rcmd: socket: %m\n");
- }
+ if (errno == EAGAIN)
+ __fxprintf(NULL, "%s", _("\
+rcmd: socket: All ports in use\n"));
+ else
+ __fxprintf(NULL, "rcmd: socket: %m\n");
+
__sigsetmask(oldmask);
freeaddrinfo(res);
return -1;
@@ -220,10 +200,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
if (__asprintf (&buf, _("connect to address %s: "),
paddr) >= 0)
{
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf(NULL, "%s", buf);
free (buf);
}
__set_errno (oerrno);
@@ -235,10 +212,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
NI_NUMERICHOST);
if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0)
{
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
}
continue;
@@ -251,14 +225,8 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
continue;
}
freeaddrinfo(res);
- if (_IO_fwide (stderr, 0) > 0)
- (void)__fwprintf(stderr, L"%s: %s\n", *ahost,
- __strerror_r(errno,
- errbuf, sizeof (errbuf)));
- else
- (void)fprintf(stderr, "%s: %s\n", *ahost,
- __strerror_r(errno,
- errbuf, sizeof (errbuf)));
+ (void)__fxprintf(NULL, "%s: %s\n", *ahost,
+ __strerror_r(errno, errbuf, sizeof (errbuf)));
__sigsetmask(oldmask);
return -1;
}
@@ -281,10 +249,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
if (__asprintf (&buf, _("\
rcmd: write (setting up stderr): %m\n")) >= 0)
{
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf(NULL, "%s", buf);
free (buf);
}
(void)__close(s2);
@@ -303,10 +268,7 @@ rcmd: poll (setting up stderr): %m\n")) >= 0)
&& __asprintf(&buf, _("\
poll: protocol failure in circuit setup\n")) >= 0))
{
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
}
(void)__close(s2);
@@ -327,12 +289,7 @@ poll: protocol failure in circuit setup\n")) >= 0))
}
(void)__close(s2);
if (s3 < 0) {
- if (_IO_fwide (stderr, 0) > 0)
- (void)__fwprintf(stderr,
- L"rcmd: accept: %m\n");
- else
- (void)fprintf(stderr,
- "rcmd: accept: %m\n");
+ (void)__fxprintf(NULL, "rcmd: accept: %m\n");
lport = 0;
goto bad;
}
@@ -344,10 +301,7 @@ poll: protocol failure in circuit setup\n")) >= 0))
if (__asprintf(&buf, _("\
socket: protocol failure in circuit setup\n")) >= 0)
{
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
}
goto bad2;
@@ -373,10 +327,7 @@ socket: protocol failure in circuit setup\n")) >= 0)
|| (n != 0
&& __asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0))
{
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
}
goto bad2;
diff --git a/libio/strfile.h b/libio/strfile.h
index b91111a..53a36a3 100644
--- a/libio/strfile.h
+++ b/libio/strfile.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1998, 1999, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -73,3 +73,14 @@ typedef struct
} _IO_strnfile;
extern const struct _IO_jump_t _IO_strn_jumps attribute_hidden;
+
+
+typedef struct
+{
+ _IO_strfile f;
+ /* This is used for the characters which do not fit in the buffer
+ provided by the user. */
+ wchar_t overflow_buf[64];
+} _IO_wstrnfile;
+
+extern const struct _IO_jump_t _IO_wstrn_jumps attribute_hidden;
diff --git a/libio/vswprintf.c b/libio/vswprintf.c
index 42168aa..eda8495 100644
--- a/libio/vswprintf.c
+++ b/libio/vswprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994,1997,1999-2002,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1997,1999-2002,2004,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,15 +29,6 @@
#include "strfile.h"
-typedef struct
-{
- _IO_strfile f;
- /* This is used for the characters which do not fit in the buffer
- provided by the user. */
- wchar_t overflow_buf[64];
-} _IO_wstrnfile;
-
-
static wint_t _IO_wstrn_overflow (_IO_FILE *fp, wint_t c) __THROW;
static wint_t
@@ -75,7 +66,7 @@ _IO_wstrn_overflow (fp, c)
}
-static const struct _IO_jump_t _IO_wstrn_jumps =
+const struct _IO_jump_t _IO_wstrn_jumps attribute_hidden =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, _IO_wstr_finish),
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index d80d6ce..4095ee0 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-08 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #408]
+ * locales/vi_VN: Update locale.
+
2005-07-05 Ulrich Drepper <drepper@redhat.com>
* locales/en_US: Remove duplicate am_pn entry.
@@ -10,14 +15,17 @@
2005-05-22 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1092]
* locales/mn_MN: Update. Patch by Sanlig Badral <s_badral@yahoo.com>.
2005-04-28 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1084]
* SUPPORTED: Add UTF-8 locales where UTF-8 was not already supported.
2005-04-26 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1091]
* locales/fa_IR: Add alt_digits, change date and time
representation, and various cleanups.
Patch by Hamed Malek <hamed@bamdad.org>.
@@ -36,10 +44,12 @@
2005-03-18 Andreas Schwab <schwab@suse.de>
+ [BZ #622]
* locales/pa_IN (am_pm): Fix character names.
2005-03-18 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1084]
* SUPPORTED (SUPPORTED-LOCALES): Add af_ZA.UTF-8.
2004-12-19 Roland McGrath <roland@frob.com>
diff --git a/localedata/locales/vi_VN b/localedata/locales/vi_VN
index df8fe35..7fc8018 100644
--- a/localedata/locales/vi_VN
+++ b/localedata/locales/vi_VN
@@ -1,23 +1,35 @@
-comment_char %
-escape_char /
-% Vietnamese language locale for Vietnam.
-% Contributed by Kentaroh Noji <knoji@jp.ibm.com> and
-% Tetsuji Orita <orita@jp.ibm.com>.
-
-% Revised by Le Hong Boi
+escape_char /
+comment_char %
+%
+% Vietnamese language locale for Vietnam
+% Source: TCVN table and info from vietnamese native speakers
+% Address:
+% Contact: Pablo Saratxaga
+% Email: srtxg@chanae.alphanet.ch
+% Tel:
+% Fax:
+% Language: vi
+% Territory: VN
+% Revision: 0.7
+% Date: 2003-02-06
+% Users: general
+% Repertoiremap:
+% Charset: UTF-8
+% Distribution and use is free, also
+% for commercial purposes.
LC_IDENTIFICATION
title "Vietnamese language locale for Vietnam"
-source "IBM Globalization Center of Competency, Yamato Software Laboratory"
-address "1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan"
-contact ""
-email "bug-glibc-locales@gnu.org"
+source "TCVN table and info from vietnamese native speakers"
+address ""
+contact "Pablo Saratxaga"
+email "srtxg@chanae.alphanet.ch"
tel ""
fax ""
language "Vietnamese"
territory "Vietnam"
-revision "1.0"
-date "2000-07-20"
+revision "0.6"
+date "2001-01-29"
%
category "vi_VN:2000";LC_IDENTIFICATION
category "vi_VN:2000";LC_CTYPE
@@ -30,200 +42,248 @@ category "vi_VN:2000";LC_PAPER
category "vi_VN:2000";LC_NAME
category "vi_VN:2000";LC_ADDRESS
category "vi_VN:2000";LC_TELEPHONE
+category "vi_VN:2000";LC_MEASUREMENT
END LC_IDENTIFICATION
LC_CTYPE
copy "i18n"
+translit_start
+
+% dong sign -> d// -> dd
+<U20AB> "<U0111>";"<U0064><U0064>"
+
+translit_end
END LC_CTYPE
LC_COLLATE
-
% Copy the template from ISO/IEC 14651
copy "iso14651_t1"
+% A( A^ E^ O+ U+ DD are treatead as base letters
+% ordering of accents is: grave, hook, tilde, acute, dot below
+% a a( a> b c d d/ e e> f g h i j k l m n o o+ p q r s t u u+ v w x y z
+
+collating-symbol <a(>
+collating-symbol <a/>>
+collating-symbol <d//>
+collating-symbol <e/>>
+collating-symbol <o/>>
+collating-symbol <o9>
+collating-symbol <u9>
+
+collating-symbol <HOK>
+
+reorder-after <BAS>
+<GRA>
+<HOK>
+<TIL>
+<ACA>
+<PCT>
+
+reorder-after <a>
+<a(>
+<a/>>
+reorder-after <d>
+<d//>
+reorder-after <e>
+<e/>>
+reorder-after <o>
+<o/>>
+<o9>
+reorder-after <u>
+<u9>
+
+reorder-after <U0061>
+<U1EA3> <a>;<HOK>;<MIN>;IGNORE
+<U0103> <a(>;<BAS>;<MIN>;IGNORE
+<U1EB1> <a(>;<GRA>;<MIN>;IGNORE
+<U1EB3> <a(>;<HOK>;<MIN>;IGNORE
+<U1EB5> <a(>;<TIL>;<MIN>;IGNORE
+<U1EAF> <a(>;<ACA>;<MIN>;IGNORE
+<U1EB7> <a(>;<PCT>;<MIN>;IGNORE
+<U00E2> <a/>>;<BAS>;<MIN>;IGNORE
+<U1EA7> <a/>>;<GRA>;<MIN>;IGNORE
+<U1EA9> <a/>>;<HOK>;<MIN>;IGNORE
+<U1EAB> <a/>>;<TIL>;<MIN>;IGNORE
+<U1EA5> <a/>>;<ACA>;<MIN>;IGNORE
+<U1EAD> <a/>>;<PCT>;<MIN>;IGNORE
+reorder-after <U0041>
+<U1EA2> <a>;<HOK>;<CAP>;IGNORE
+<U0102> <a(>;<BAS>;<CAP>;IGNORE
+<U1EB0> <a(>;<GRA>;<CAP>;IGNORE
+<U1EB3> <a(>;<HOK>;<CAP>;IGNORE
+<U1EB4> <a(>;<TIL>;<CAP>;IGNORE
+<U1EAE> <a(>;<ACA>;<CAP>;IGNORE
+<U1EB6> <a(>;<PCT>;<CAP>;IGNORE
+<U00C2> <a/>>;<BAS>;<CAP>;IGNORE
+<U1EA6> <a/>>;<GRA>;<CAP>;IGNORE
+<U1EA8> <a/>>;<HOK>;<CAP>;IGNORE
+<U1EAA> <a/>>;<TIL>;<CAP>;IGNORE
+<U1EA4> <a/>>;<ACA>;<CAP>;IGNORE
+<U1EAC> <a/>>;<PCT>;<CAP>;IGNORE
+
+reorder-after <U0064>
+<U0111> <d//>;<BAS>;<MIN>;IGNORE
+<U00F0> <d//>;<PCL>;<MIN>;IGNORE
+reorder-after <U0044>
+<U0110> <d//>;<BAS>;<CAP>;IGNORE
+<U00D0> <d//>;<PCL>;<CAP>;IGNORE
+
+reorder-after <U0065>
+<U1EBB> <e>;<HOK>;<MIN>;IGNORE
+<U00EA> <e/>>;<BAS>;<MIN>;IGNORE
+<U1EC1> <e/>>;<GRA>;<MIN>;IGNORE
+<U1EC3> <e/>>;<HOK>;<MIN>;IGNORE
+<U1EC5> <e/>>;<TIL>;<MIN>;IGNORE
+<U1EBF> <e/>>;<ACA>;<MIN>;IGNORE
+<U1EC7> <e/>>;<PCT>;<MIN>;IGNORE
+reorder-after <U0045>
+<U1EBA> <e>;<HOK>;<CAP>;IGNORE
+<U00CA> <e/>>;<BAS>;<CAP>;IGNORE
+<U1EC0> <e/>>;<GRA>;<CAP>;IGNORE
+<U1EC2> <e/>>;<HOK>;<CAP>;IGNORE
+<U1EC4> <e/>>;<TIL>;<CAP>;IGNORE
+<U1EBE> <e/>>;<ACA>;<CAP>;IGNORE
+<U1EC6> <e/>>;<PCT>;<CAP>;IGNORE
+
+reorder-after <U0069>
+<U1EC9> <i>;<HOK>;<MIN>;IGNORE
+reorder-after <U0049>
+<U1EC8> <i>;<HOK>;<CAP>;IGNORE
+
+reorder-after <U006F>
+<U1ECF> <o>;<HOK>;<MIN>;IGNORE
+<U00F4> <o/>>;<BAS>;<MIN>;IGNORE
+<U1ED3> <o/>>;<GRA>;<MIN>;IGNORE
+<U1ED5> <o/>>;<HOK>;<MIN>;IGNORE
+<U1ED7> <o/>>;<TIL>;<MIN>;IGNORE
+<U1ED1> <o/>>;<ACA>;<MIN>;IGNORE
+<U1ED9> <o/>>;<PCT>;<MIN>;IGNORE
+<U01A1> <o9>;<BAS>;<MIN>;IGNORE
+<U1EDD> <o9>;<GRA>;<MIN>;IGNORE
+<U1EDF> <o9>;<HOK>;<MIN>;IGNORE
+<U1EE1> <o9>;<TIL>;<MIN>;IGNORE
+<U1EDB> <o9>;<ACA>;<MIN>;IGNORE
+<U1EE3> <o9>;<PCT>;<MIN>;IGNORE
+reorder-after <U004F>
+<U1ECE> <o>;<HOK>;<CAP>;IGNORE
+<U00D4> <o/>>;<BAS>;<CAP>;IGNORE
+<U1ED2> <o/>>;<GRA>;<CAP>;IGNORE
+<U1ED4> <o/>>;<HOK>;<CAP>;IGNORE
+<U1ED6> <o/>>;<TIL>;<CAP>;IGNORE
+<U1ED0> <o/>>;<ACA>;<CAP>;IGNORE
+<U1ED8> <o/>>;<PCT>;<CAP>;IGNORE
+<U01A0> <o9>;<BAS>;<CAP>;IGNORE
+<U1EDC> <o9>;<GRA>;<CAP>;IGNORE
+<U1EDE> <o9>;<HOK>;<CAP>;IGNORE
+<U1EE0> <o9>;<TIL>;<CAP>;IGNORE
+<U1EDA> <o9>;<ACA>;<CAP>;IGNORE
+<U1EE2> <o9>;<PCT>;<CAP>;IGNORE
+
+reorder-after <U0075>
+<U1EE7> <u>;<HOK>;<MIN>;IGNORE
+<U01B0> <u9>;<BAS>;<MIN>;IGNORE
+<U1EEB> <u9>;<GRA>;<MIN>;IGNORE
+<U1EED> <u9>;<HOK>;<MIN>;IGNORE
+<U1EEF> <u9>;<TIL>;<MIN>;IGNORE
+<U1EE9> <u9>;<ACA>;<MIN>;IGNORE
+<U1EF1> <u9>;<PCT>;<MIN>;IGNORE
+reorder-after <U0055>
+<U1EE6> <u>;<HOK>;<CAP>;IGNORE
+<U01AF> <u9>;<BAS>;<CAP>;IGNORE
+<U1EEA> <u9>;<GRA>;<CAP>;IGNORE
+<U1EEC> <u9>;<HOK>;<CAP>;IGNORE
+<U1EEE> <u9>;<TIL>;<CAP>;IGNORE
+<U1EE8> <u9>;<ACA>;<CAP>;IGNORE
+<U1EF0> <u9>;<PCT>;<CAP>;IGNORE
+
+reorder-after <U0079>
+<U1EF7> <y>;<HOK>;<MIN>;IGNORE
+reorder-after <U0059>
+<U1EF6> <y>;<HOK>;<CAP>;IGNORE
+
+reorder-end
+
END LC_COLLATE
LC_MONETARY
-% This is the POSIX Locale definition the LC_MONETARY category.
-% These are generated based on XML base Locale difintion file
-% for IBM Class for Unicode/Java
-%
int_curr_symbol "<U0056><U004E><U0044><U0020>"
currency_symbol "<U20AB>"
mon_decimal_point "<U002C>"
mon_thousands_sep "<U002E>"
-mon_grouping 3
+mon_grouping 3;3
positive_sign ""
negative_sign "<U002D>"
-int_frac_digits 2
-frac_digits 2
+int_frac_digits 4
+frac_digits 4
p_cs_precedes 0
p_sep_by_space 0
n_cs_precedes 1
n_sep_by_space 0
p_sign_posn 1
n_sign_posn 1
-%
END LC_MONETARY
-
LC_NUMERIC
-% This is the POSIX Locale definition for the LC_NUMERIC category.
-%
-decimal_point "<U002C>"
-thousands_sep "<U002E>"
-grouping 3
-%
+decimal_point "<U002C>"
+thousands_sep "<U002E>"
+grouping 3;3
END LC_NUMERIC
-
LC_TIME
-% This is the POSIX Locale definition for the LC_TIME category.
-% These are generated based on XML base Locale difintion file
-% for IBM Class for Unicode/Java
-%
-% Abbreviated weekday names (%a)
-abday "<U0043><U004E><U0020>";/
- "<U0054><U0068><U0020><U0032><U0020>";/
- "<U0054><U0068><U0020><U0033><U0020>";/
- "<U0054><U0068><U0020><U0034><U0020>";/
- "<U0054><U0068><U0020><U0035><U0020>";/
- "<U0054><U0068><U0020><U0036><U0020>";/
- "<U0054><U0068><U0020><U0037><U0020>"
-%
-% Full weekday names (%A)
-day "<U0043><U0068><U0075><U0309><U0020><U006E><U0068><U00E2><U0323>/
-<U0074><U0020>";/
- "<U0054><U0068><U01B0><U0301><U0020><U0068><U0061><U0069><U0020>";/
- "<U0054><U0068><U01B0><U0301><U0020><U0062><U0061><U0020>";/
- "<U0054><U0068><U01B0><U0301><U0020><U0074><U01B0><U0020>";/
- "<U0054><U0068><U01B0><U0301><U0020><U006E><U0103><U006D><U0020>";/
- "<U0054><U0068><U01B0><U0301><U0020><U0073><U00E1><U0075><U0020>";/
- "<U0054><U0068><U01B0><U0301><U0020><U0062><U0061><U0309><U0079>/
-<U0020>"
-%
-% Abbreviated month names (%b)
-abmon "<U0054><U0068><U0067><U0020><U0031>";/
- "<U0054><U0068><U0067><U0020><U0032>";/
- "<U0054><U0068><U0067><U0020><U0033>";/
- "<U0054><U0068><U0067><U0020><U0034>";/
- "<U0054><U0068><U0067><U0020><U0035>";/
- "<U0054><U0068><U0067><U0020><U0036>";/
- "<U0054><U0068><U0067><U0020><U0037>";/
- "<U0054><U0068><U0067><U0020><U0038>";/
- "<U0054><U0068><U0067><U0020><U0039>";/
- "<U0054><U0068><U0067><U0020><U0031><U0030>";/
- "<U0054><U0068><U0067><U0020><U0031><U0031>";/
- "<U0054><U0068><U0067><U0020><U0031><U0032>"
-%
-% Full month names (%B)
-mon "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U00F4><U0323>/
-<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>";/
- "<U0054><U0068><U00E1><U006E><U0067><U0020><U006E><U0103><U006D>";/
- "<U0054><U0068><U00E1><U006E><U0067><U0020><U0073><U00E1><U0075>";/
- "<U0054><U0068><U00E1><U006E><U0067><U0020><U0062><U0061><U0309>/
-<U0079>";/
- "<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><U01A1>/
-<U0300><U0069>";/
- "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U01B0><U01A1>/
-<U0300><U0069><U0020><U006D><U00F4><U0323><U0074>";/
- "<U0054><U0068><U00E1><U006E><U0067><U0020><U006D><U01B0><U01A1>/
-<U0300><U0069><U0020><U0068><U0061><U0069>"
-%
-% Equivalent of AM PM
-am_pm "";""
-%
-% Appropriate date and time representation
-% %A %d %b %Y%H:%M:%S %Z
-d_t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
-<U0020><U0025><U005A><U0020><U0025><U0041><U0020><U0025><U0064><U0020>/
-<U0025><U0062><U0020><U0025><U0059>"
-%
-% Appropriate date representation
-% %A %d %b %Y
-d_fmt "<U0025><U0041><U0020><U0025><U0064><U0020><U0025><U0062>/
-<U0020><U0025><U0059>"
-%
-% Appropriate time representation
-% %H:%M:%S %Z
-t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
-<U0020><U0025><U005A>"
-%
-% Appropriate 12 h time representation (%r)
-t_fmt_ampm ""
-%
-% Appropriate date representation (date(1)) "%H:%M:%S %a %e %b %Y %Z"
-date_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
-<U0020><U0025><U0061><U0020><U0025><U0065><U0020><U0025><U0062>/
-<U0020><U0025><U0059><U0020><U0025><U005A>"
+abday "<U0043><U004E>";"<U0054><U0068><U0032>";/
+ "<U0054><U0068><U0033>";"<U0054><U0068><U0034>";/
+ "<U0054><U0068><U0035>";"<U0054><U0068><U0036>";/
+ "<U0054><U0068><U0037>"
+day "<U0063><U0068><U1EE7><U0020><U006E><U0068><U1EAD><U0074>";/
+ "<U0074><U0068><U1EE9><U0020><U0068><U0061><U0069>";/
+ "<U0074><U0068><U1EE9><U0020><U0062><U0061>";/
+ "<U0074><U0068><U1EE9><U0020><U0074><U01B0>";/
+ "<U0074><U0068><U1EE9><U0020><U006E><U0103><U006D>";/
+ "<U0074><U0068><U1EE9><U0020><U0073><U00E1><U0075>";/
+ "<U0074><U0068><U1EE9><U0020><U0062><U1EA3><U0079>"
+abmon "<U0054><U0068><U0067><U0031>";"<U0054><U0068><U0067><U0032>";/
+ "<U0054><U0068><U0067><U0033>";"<U0054><U0068><U0067><U0034>";/
+ "<U0054><U0068><U0067><U0035>";"<U0054><U0068><U0067><U0036>";/
+ "<U0054><U0068><U0067><U0037>";"<U0054><U0068><U0067><U0038>";/
+ "<U0054><U0068><U0067><U0039>";"<U0054><U0068><U0067><U0031><U0030>";/
+ "<U0054><U0068><U0067><U0031><U0031>";"<U0054><U0068><U0067><U0031><U0032>"
+mon "<U0074><U0068><U00E1><U006E><U0067><U0020><U0067><U0069><U00EA><U006E><U0067>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U0068><U0061><U0069>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U0062><U0061>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U0074><U01B0>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U006E><U0103><U006D>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U0073><U00E1><U0075>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U0062><U1EA3><U0079>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U0074><U00E1><U006D>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U0063><U0068><U00ED><U006E>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U006D><U01B0><U1EDD><U0069>";/
+ "<U0074><U0068><U00E1><U006E><U0067><U0020><U006D><U1ED9><U0074>";/
+ "<U0074><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>"
+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>"
+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
-
+% yes: Va^ng / Da.
+% no: Kho^ng
LC_MESSAGES
-yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>"
-noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
+yesstr "<U0056><U00E2><U006E><U0067>"
+nostr "<U004B><U0068><U00F4><U006E><U0067>"
+yesexpr "<U005E><U005B><U0031><U0079><U0059><U0076><U0056><U0064><U0044><U0063><U0043><U005D><U002E><U002A>"
+noexpr "<U005E><U005B><U0030><U006E><U004E><U006B><U004B><U005D><U002E><U002A>"
END LC_MESSAGES
-
LC_PAPER
-% This is the ISO_IEC TR14652 Locale definition for the
-% LC_PAPER category
height 297
width 210
-
END LC_PAPER
-
-LC_NAME
-% This is the ISO_IEC TR14652 Locale definition for the
-% LC_NAME category.
-%
-name_fmt "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074>/
-<U0025><U0067>"
-name_gen ""
-name_mr "<U00D4><U002E>"
-name_mrs "<U0042><U002E>"
-name_miss "<U0043><U002E>"
-name_ms ""
-
-END LC_NAME
-
-
-LC_ADDRESS
-% This is the ISO_IEC TR14652 Locale definition for the
-% LC_ADDRESS
-postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
-<U0025><U0062><U0025><U0065><U0025><U0072>"
-country_name "<U0056><U0069><U1EC7><U0074><U0020><U006E><U0061><U006D>"
-lang_name "<U0056><U0069><U1EC7><U0074><U0020><U006E><U0067><U1EEF>"
-
-country_ab2 "<U0056><U004E>"
-country_ab3 "<U0056><U004E><U004D>"
-country_num 704
-END LC_ADDRESS
-
-
-LC_TELEPHONE
-% This is the ISO_IEC TR14652 Locale definition for the
-%
-tel_int_fmt "<U002B><U0025><U0063><U0020><U003B><U0025><U0061><U0020>/
-<U003B><U0025><U006C>"
-int_prefix "<U0038><U0034>"
-int_select "<U0030><U0030>"
-
-END LC_TELEPHONE
-
-
LC_MEASUREMENT
-% This is the ISO_IEC TR14652 Locale definition for the
-%
measurement 1
-
END LC_MEASUREMENT
+
diff --git a/malloc/obstack.c b/malloc/obstack.c
index fddda3e..aba21f9 100644
--- a/malloc/obstack.c
+++ b/malloc/obstack.c
@@ -1,6 +1,6 @@
/* obstack.c - subroutines used implicitly by object stack macros
- Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
@@ -410,12 +410,7 @@ print_and_abort (void)
happen because the "memory exhausted" message appears in other places
like this and the translation should be reused instead of creating
a very similar string which requires a separate translation. */
-# if defined _LIBC && defined USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s\n", _("memory exhausted"));
- else
-# endif
- fprintf (stderr, "%s\n", _("memory exhausted"));
+ (void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
exit (obstack_exit_failure);
}
diff --git a/manual/Makefile b/manual/Makefile
index a29fdd2..c007b2c 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -80,7 +80,7 @@ libc.dvi libc.pdf libc.info: chapters.texi top-menu.texi dir-add.texi \
libc.dvi libc.pdf: texinfo.tex
html: libc/index.html
-libc/index.html: chapters.texi top-menu.texi libm-err.texi
+libc/index.html: chapters.texi top-menu.texi dir-add.texi libm-err.texi
$(MAKEINFO) --html libc.texinfo
# Generate the summary from the Texinfo source files for each chapter.
diff --git a/misc/Makefile b/misc/Makefile
index 862eb1b..cd5b64e 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -65,6 +65,8 @@ routines := brk sbrk sstk ioctl \
distribute := device-nrs.h
+generated := tst-error1.mtrace tst-error1-mem
+
include ../Makeconfig
aux := init-misc
@@ -73,7 +75,11 @@ install-lib := libbsd-compat.a libg.a
endif
gpl2lgpl := error.c error.h
-tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch
+tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
+ tst-error1
+ifeq (no,$(cross-compiling))
+tests: $(objpfx)tst-error1-mem
+endif
CFLAGS-tsearch.c = $(uses-callbacks)
CFLAGS-lsearch.c = $(uses-callbacks)
@@ -106,3 +112,8 @@ endif
ifeq ($(build-bounded),yes)
$(objpfx)tst-tsearch-bp: $(common-objpfx)math/libm_b.a
endif
+
+tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace
+tst-error1-ARGS = $(objpfx)tst-error1.out
+$(objpfx)tst-error1-mem: $(objpfx)tst-error1.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-error1.mtrace > $@
diff --git a/misc/error.c b/misc/error.c
index 2501583..29060e9 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -1,7 +1,6 @@
/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
+ Copyright (C) 1990-1998, 2000-2004, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -74,6 +73,7 @@ unsigned int error_message_count;
# define program_name program_invocation_name
# include <errno.h>
+# include <limits.h>
# include <libio/libioP.h>
/* In GNU libc we want do not want to use the common name `error' directly.
@@ -158,14 +158,10 @@ print_errno_message (int errnum)
#endif
#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- {
- __fwprintf (stderr, L": %s", s);
- return;
- }
-#endif
-
+ __fxprintf (NULL, ": %s", s);
+#else
fprintf (stderr, ": %s", s);
+#endif
}
#ifdef VA_START
@@ -182,14 +178,15 @@ error_tail (int status, int errnum, const char *message, va_list args)
mbstate_t st;
size_t res;
const char *tmp;
+ bool use_malloc = false;
- do
+ while (1)
{
- if (len < ALLOCA_LIMIT)
+ if (__libc_use_alloca (len * sizeof (wchar_t)))
wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
else
{
- if (wmessage != NULL && len / 2 < ALLOCA_LIMIT)
+ if (!use_malloc)
wmessage = NULL;
wchar_t *p = (wchar_t *) realloc (wmessage,
@@ -201,18 +198,38 @@ error_tail (int status, int errnum, const char *message, va_list args)
return;
}
wmessage = p;
+ use_malloc = true;
}
memset (&st, '\0', sizeof (st));
tmp = message;
+
+ res = mbsrtowcs (wmessage, &tmp, len, &st);
+ if (res != len)
+ break;
+
+ if (__builtin_expect (len >= SIZE_MAX / 2, 0))
+ {
+ /* This reallyy should not happen if everything is fine. */
+ res = (size_t) -1;
+ break;
+ }
+
+ len *= 2;
}
- while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len);
if (res == (size_t) -1)
- /* The string cannot be converted. */
- wmessage = (wchar_t *) L"???";
+ {
+ /* The string cannot be converted. */
+ if (use_malloc)
+ free (wmessage);
+ wmessage = (wchar_t *) L"???";
+ }
__vfwprintf (stderr, wmessage, args);
+
+ if (use_malloc)
+ free (wmessage);
}
else
# endif
@@ -226,11 +243,10 @@ error_tail (int status, int errnum, const char *message, va_list args)
if (errnum)
print_errno_message (errnum);
# if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- putwc (L'\n', stderr);
- else
+ __fxprintf (NULL, "\n");
+# else
+ putc ('\n', stderr);
# endif
- putc ('\n', stderr);
fflush (stderr);
if (status)
exit (status);
@@ -275,11 +291,10 @@ error (status, errnum, message, va_alist)
else
{
#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s: ", program_name);
- else
+ __fxprintf (NULL, "%s: ", program_name);
+#else
+ fprintf (stderr, "%s: ", program_name);
#endif
- fprintf (stderr, "%s: ", program_name);
}
#ifdef VA_START
@@ -359,21 +374,19 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
else
{
#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s: ", program_name);
- else
+ __fxprintf (NULL, "%s:", program_name);
+#else
+ fprintf (stderr, "%s:", program_name);
#endif
- fprintf (stderr, "%s:", program_name);
}
if (file_name != NULL)
{
#if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s:%d: ", file_name, line_number);
- else
+ __fxprintf (NULL, "%s:%d: ", file_name, line_number);
+#else
+ fprintf (stderr, "%s:%d: ", file_name, line_number);
#endif
- fprintf (stderr, "%s:%d: ", file_name, line_number);
}
#ifdef VA_START
diff --git a/misc/getpass.c b/misc/getpass.c
index 62e5686..5290c3c 100644
--- a/misc/getpass.c
+++ b/misc/getpass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1999, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1999,2001,2003,2004,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -91,12 +91,7 @@ getpass (prompt)
tty_changed = 0;
/* Write the prompt. */
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (out, 0) > 0)
- __fwprintf (out, L"%s", prompt);
- else
-#endif
- fputs_unlocked (prompt, out);
+ __fxprintf (out, "%s", prompt);
fflush_unlocked (out);
/* Read the password. */
@@ -110,15 +105,8 @@ getpass (prompt)
/* Remove the newline. */
buf[nread - 1] = '\0';
if (tty_changed)
- {
- /* Write the newline that was not echoed. */
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (out, 0) > 0)
- putwc_unlocked (L'\n', out);
- else
-#endif
- putc_unlocked ('\n', out);
- }
+ /* Write the newline that was not echoed. */
+ __fxprintf (out, "\n");
}
}
diff --git a/misc/tst-error1.c b/misc/tst-error1.c
new file mode 100644
index 0000000..e84843e
--- /dev/null
+++ b/misc/tst-error1.c
@@ -0,0 +1,26 @@
+#include <error.h>
+#include <mcheck.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+static int
+do_test (int argc, char *argv[])
+{
+ mtrace ();
+ (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr);
+ /* Orient the stream. */
+ fwprintf (stderr, L"hello world\n");
+ char buf[20000];
+ static const char str[] = "hello world! ";
+ for (int i = 0; i < 1000; ++i)
+ memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
+ error (0, 0, str);
+ error (0, 0, buf);
+ error (0, 0, buf);
+ error (0, 0, str);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index aa5874a..0128865 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,23 @@
+2005-07-11 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #1102]
+ * sysdeps/pthread/pthread.h (PTHREAD_MUTEX_INITIALIZER,
+ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
+ PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP,
+ PTHREAD_MUTEX_ADAPTIVE_NP, PTHREAD_RWLOCK_INITIALIZER,
+ PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ PTHREAD_COND_INITIALIZER): Supply zeros for all fields
+ in the structure.
+ * Makefile (tests): Add tst-initializers1.
+ (CFLAGS-tst-initializers1.c): Set.
+ * tst-initializers1.c: New test.
+
+2005-07-11 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_rwlock_t):
+ Make sure __flags are located at offset 48 from the start of the
+ structure.
+
2005-07-02 Roland McGrath <roland@redhat.com>
* Makeconfig: Comment fix.
@@ -122,6 +142,7 @@
2005-04-05 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1102]
* sysdeps/pthread/pthread.h (__pthread_cleanup_routine): Use
__inline instead of inline.
* sysdeps/pthread/bits/libc-lock.h (__libc_cleanup_routine): Likewise.
diff --git a/nptl/Makefile b/nptl/Makefile
index 184375a..1fbe464 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -241,7 +241,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
tst-backtrace1 \
tst-oddstacklimit \
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
- tst-getpid1 tst-getpid2
+ tst-getpid1 tst-getpid2 tst-initializers1
xtests = tst-setuid1 tst-setuid1-static
# Files which must not be linked with libpthread.
@@ -412,6 +412,7 @@ CFLAGS-tst-cleanupx4.c += -fexceptions
CFLAGS-tst-oncex3.c += -fexceptions
CFLAGS-tst-oncex4.c += -fexceptions
CFLAGS-tst-align.c += $(stack-align-test-flags)
+CFLAGS-tst-initializers1.c += -W -Wall -Werror
tst-cancel7-ARGS = --command "$(built-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index 05f3b31..92e66f7 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -62,22 +62,22 @@ enum
/* Mutex initializers. */
#define PTHREAD_MUTEX_INITIALIZER \
- { { 0, } }
+ { { 0, 0, 0, 0, 0, 0 } }
#ifdef __USE_GNU
# if __WORDSIZE == 64
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0 } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0 } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0 } }
# else
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+ { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, 0 } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+ { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, 0 } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+ { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, 0 } }
# endif
#endif
@@ -93,8 +93,13 @@ enum
};
/* Read-write lock initializers. */
-# define PTHREAD_RWLOCK_INITIALIZER \
- { { 0, } }
+# if __WORDSIZE == 64
+# define PTHREAD_RWLOCK_INITIALIZER \
+ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
+# else
+# define PTHREAD_RWLOCK_INITIALIZER \
+ { { 0, 0, 0, 0, 0, 0, 0, 0 } }
+# endif
# ifdef __USE_GNU
# if __WORDSIZE == 64
# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
@@ -102,7 +107,7 @@ enum
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
# else
# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
- { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
+ { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0 } }
# endif
# endif
#endif /* Unix98 or XOpen2K */
@@ -140,7 +145,7 @@ enum
/* Conditional variable handling. */
-#define PTHREAD_COND_INITIALIZER { { 0, } }
+#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
/* Cleanup buffers */
diff --git a/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
index d13d6e8..86b4703 100644
--- a/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
@@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. Alpha version.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -117,8 +117,9 @@ typedef union
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
-
- unsigned int __reserved[6];
+ int __pad1;
+ unsigned long int __pad2;
+ unsigned long int __pad3;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
diff --git a/nptl/tst-initializers1.c b/nptl/tst-initializers1.c
new file mode 100644
index 0000000..ccd2728
--- /dev/null
+++ b/nptl/tst-initializers1.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <pthread.h>
+
+pthread_mutex_t mtx_normal = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mtx_recursive = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+pthread_mutex_t mtx_errorchk = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+pthread_mutex_t mtx_adaptive = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
+pthread_rwlock_t rwl_normal = PTHREAD_RWLOCK_INITIALIZER;
+pthread_rwlock_t rwl_writer
+ = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+int
+main (void)
+{
+ if (mtx_normal.__data.__kind != PTHREAD_MUTEX_TIMED_NP)
+ return 1;
+ if (mtx_recursive.__data.__kind != PTHREAD_MUTEX_RECURSIVE_NP)
+ return 1;
+ if (mtx_errorchk.__data.__kind != PTHREAD_MUTEX_ERRORCHECK_NP)
+ return 1;
+ if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP)
+ return 1;
+ if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP)
+ return 1;
+ if (rwl_writer.__data.__flags
+ != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)
+ return 1;
+ return 0;
+}
diff --git a/nscd/Makefile b/nscd/Makefile
index 2ebd90b..5a2d29a 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -84,10 +84,13 @@ CFLAGS-nscd_gethst_r.c = -fexceptions
CFLAGS-nscd_getai.c = -fexceptions
CFLAGS-nscd_initgroups.c = -fexceptions
-nscd-cflags = -DIS_IN_nscd=1
+nscd-cflags = -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
ifeq (yesyes,$(have-fpie)$(build-shared))
nscd-cflags += -fpie
endif
+ifeq (yes,$(have-ssp))
+nscd-cflags += -fstack-protector
+endif
CFLAGS-nscd.c += $(nscd-cflags)
CFLAGS-connections.c += $(nscd-cflags)
diff --git a/nscd/connections.c b/nscd/connections.c
index 0ca7585..d18851f 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -393,20 +393,23 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
if (offset % ps != 0)
{
towrite = MIN (remaining, ps - (offset % ps));
- pwrite (fd, tmpbuf, towrite, offset);
+ if (pwrite (fd, tmpbuf, towrite, offset) != towrite)
+ goto write_fail;
offset += towrite;
remaining -= towrite;
}
while (remaining > ps)
{
- pwrite (fd, tmpbuf, ps, offset);
+ if (pwrite (fd, tmpbuf, ps, offset) == -1)
+ goto write_fail;
offset += ps;
remaining -= ps;
}
- if (remaining > 0)
- pwrite (fd, tmpbuf, remaining, offset);
+ if (remaining > 0
+ && pwrite (fd, tmpbuf, remaining, offset) != remaining)
+ goto write_fail;
/* Create the header of the file. */
struct database_pers_head head =
@@ -426,6 +429,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
|| (mem = mmap (NULL, total, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0)) == MAP_FAILED)
{
+ write_fail:
unlink (dbs[cnt].db_filename);
dbg_log (_("cannot write to database file %s: %s"),
dbs[cnt].db_filename, strerror (errno));
@@ -604,9 +608,14 @@ send_ro_fd (struct database_dyn *db, char *key, int fd)
iov[0].iov_len = strlen (key) + 1;
/* Prepare the control message to transfer the descriptor. */
- char buf[CMSG_SPACE (sizeof (int))];
+ union
+ {
+ struct cmsghdr hdr;
+ char bytes[CMSG_SPACE (sizeof (int))];
+ } buf;
struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1,
- .msg_control = buf, .msg_controllen = sizeof (buf) };
+ .msg_control = buf.bytes,
+ .msg_controllen = sizeof (buf) };
struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
cmsg->cmsg_level = SOL_SOCKET;
@@ -960,7 +969,9 @@ cannot change to old working directory: %s; disabling paranoia mode"),
setuid (server_uid);
setgid (server_gid);
}
- chdir ("/");
+ if (chdir ("/") != 0)
+ dbg_log (_("cannot change current working directory to \"/\": %s"),
+ strerror (errno));
paranoia = 0;
}
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 5d327f3..c938554 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -167,7 +167,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
char *gr_name;
char *cp;
const size_t key_len = strlen (key);
- const size_t buf_len = 3 + sizeof (grp->gr_gid) + key_len + 1;
+ const size_t buf_len = 3 * sizeof (grp->gr_gid) + key_len + 1;
char *buf = alloca (buf_len);
ssize_t n;
size_t cnt;
diff --git a/nscd/nscd.c b/nscd/nscd.c
index e6921c2..4d14f06 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -243,7 +243,9 @@ main (int argc, char **argv)
setsid ();
- chdir ("/");
+ if (chdir ("/") != 0)
+ error (EXIT_FAILURE, errno,
+ _("cannot change current working cirectory to \"/\""));
openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index c99cb43..65e78a1 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -26,6 +26,7 @@
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <not-cancel.h>
@@ -135,6 +136,36 @@ __nscd_unmap (struct mapped_database *mapped)
}
+static int
+wait_on_socket (int sock)
+{
+ struct pollfd fds[1];
+ fds[0].fd = sock;
+ fds[0].events = POLLIN | POLLERR | POLLHUP;
+ int n = __poll (fds, 1, 5 * 1000);
+ if (n == -1 && __builtin_expect (errno == EINTR, 0))
+ {
+ /* Handle the case where the poll() call is interrupted by a
+ signal. We cannot just use TEMP_FAILURE_RETRY since it might
+ lead to infinite loops. */
+ struct timeval now;
+ (void) __gettimeofday (&now, NULL);
+ long int end = (now.tv_sec + 5) * 1000 + (now.tv_usec + 500) / 1000;
+ while (1)
+ {
+ long int timeout = end - (now.tv_sec * 1000
+ + (now.tv_usec + 500) / 1000);
+ n = __poll (fds, 1, timeout);
+ if (n != -1 || errno != EINTR)
+ break;
+ (void) __gettimeofday (&now, NULL);
+ }
+ }
+
+ return n;
+}
+
+
/* Try to get a file descriptor for the shared meory segment
containing the database. */
static struct mapped_database *
@@ -166,8 +197,8 @@ get_mapping (request_type type, const char *key,
iov[1].iov_base = (void *) key;
iov[1].iov_len = keylen;
- if (TEMP_FAILURE_RETRY (__writev (sock, iov, 2))
- != iov[0].iov_len + iov[1].iov_len)
+ if (__builtin_expect (TEMP_FAILURE_RETRY (__writev (sock, iov, 2))
+ != iov[0].iov_len + iov[1].iov_len, 0))
/* We cannot even write the request. */
goto out_close2;
@@ -176,73 +207,80 @@ get_mapping (request_type type, const char *key,
iov[0].iov_base = resdata;
iov[0].iov_len = keylen;
- char buf[CMSG_SPACE (sizeof (int))];
+ union
+ {
+ struct cmsghdr hdr;
+ char bytes[CMSG_SPACE (sizeof (int))];
+ } buf;
struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1,
- .msg_control = buf, .msg_controllen = sizeof (buf) };
+ .msg_control = buf.bytes,
+ .msg_controllen = sizeof (buf) };
struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN (sizeof (int));
+ /* This access is well-aligned since BUF is correctly aligned for an
+ int and CMSG_DATA preserves this alignment. */
*(int *) CMSG_DATA (cmsg) = -1;
msg.msg_controllen = cmsg->cmsg_len;
- struct pollfd fds[1];
- fds[0].fd = sock;
- fds[0].events = POLLIN | POLLERR | POLLHUP;
- if (__poll (fds, 1, 5 * 1000) <= 0)
- /* Failure or timeout. */
+ if (wait_on_socket (sock) <= 0)
goto out_close2;
#ifndef MSG_NOSIGNAL
# define MSG_NOSIGNAL 0
#endif
- if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, MSG_NOSIGNAL)) != keylen)
+ if (__builtin_expect (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg,
+ MSG_NOSIGNAL))
+ != keylen, 0))
goto out_close2;
mapfd = *(int *) CMSG_DATA (cmsg);
- if (CMSG_FIRSTHDR (&msg)->cmsg_len != CMSG_LEN (sizeof (int)))
+ if (__builtin_expect (CMSG_FIRSTHDR (&msg)->cmsg_len
+ != CMSG_LEN (sizeof (int)), 0))
goto out_close;
struct stat64 st;
- if (strcmp (resdata, key) != 0
- || fstat64 (mapfd, &st) != 0
- || st.st_size < sizeof (struct database_pers_head))
+ if (__builtin_expect (strcmp (resdata, key) != 0, 0)
+ || __builtin_expect (fstat64 (mapfd, &st) != 0, 0)
+ || __builtin_expect (st.st_size < sizeof (struct database_pers_head), 0))
goto out_close;
struct database_pers_head head;
- if (TEMP_FAILURE_RETRY (__pread (mapfd, &head, sizeof (head), 0))
- != sizeof (head))
+ if (__builtin_expect (TEMP_FAILURE_RETRY (__pread (mapfd, &head,
+ sizeof (head), 0))
+ != sizeof (head), 0))
goto out_close;
- if (head.version != DB_VERSION || head.header_size != sizeof (head)
+ if (__builtin_expect (head.version != DB_VERSION, 0)
+ || __builtin_expect (head.header_size != sizeof (head), 0)
/* This really should not happen but who knows, maybe the update
thread got stuck. */
- || (! head.nscd_certainly_running
- && head.timestamp + MAPPING_TIMEOUT < time (NULL)))
+ || __builtin_expect (! head.nscd_certainly_running
+ && head.timestamp + MAPPING_TIMEOUT < time (NULL),
+ 0))
goto out_close;
size_t size = (sizeof (head) + roundup (head.module * sizeof (ref_t), ALIGN)
+ head.data_size);
- if (st.st_size < size)
+ if (__builtin_expect (st.st_size < size, 0))
goto out_close;
/* The file is large enough, map it now. */
void *mapping = __mmap (NULL, size, PROT_READ, MAP_SHARED, mapfd, 0);
- if (mapping != MAP_FAILED)
+ if (__builtin_expect (mapping != MAP_FAILED, 1))
{
/* Allocate a record for the mapping. */
- struct mapped_database *newp;
-
- newp = malloc (sizeof (*newp));
+ struct mapped_database *newp = malloc (sizeof (*newp));
if (newp == NULL)
{
/* Ugh, after all we went through the memory allocation failed. */
- __munmap (result, size);
+ __munmap (mapping, size);
goto out_close;
}
@@ -372,19 +410,13 @@ __nscd_open_socket (const char *key, size_t keylen, request_type type,
vec[1].iov_len = keylen;
ssize_t nbytes = TEMP_FAILURE_RETRY (__writev (sock, vec, 2));
- if (nbytes == (ssize_t) (sizeof (request_header) + keylen))
- {
+ if (nbytes == (ssize_t) (sizeof (request_header) + keylen)
/* Wait for data. */
- struct pollfd fds[1];
- fds[0].fd = sock;
- fds[0].events = POLLIN | POLLERR | POLLHUP;
- if (__poll (fds, 1, 5 * 1000) > 0)
- {
- nbytes = TEMP_FAILURE_RETRY (__read (sock, response,
- responselen));
- if (nbytes == (ssize_t) responselen)
- return sock;
- }
+ && wait_on_socket (sock) > 0)
+ {
+ nbytes = TEMP_FAILURE_RETRY (__read (sock, response, responselen));
+ if (nbytes == (ssize_t) responselen)
+ return sock;
}
close_not_cancel_no_status (sock);
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
index cb82818..b6c756a 100644
--- a/posix/bits/unistd.h
+++ b/posix/bits/unistd.h
@@ -128,3 +128,101 @@ __NTH (getwd (char *__buf))
return __getwd_alias (__buf);
}
#endif
+
+extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
+ size_t __buflen) __THROW;
+extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf,
+ size_t __len), confstr);
+
+extern __always_inline size_t
+confstr (int __name, char *__buf, size_t __len)
+{
+ if (__bos (__buf) != (size_t) -1
+ && (!__builtin_constant_p (__len) || __bos (__buf) < __len))
+ return __confstr_chk (__name, __buf, __len, __bos (__buf));
+ return __confstr_alias (__name, __buf, __len);
+}
+
+
+extern int __getgroups_chk (int __size, __gid_t __list[], size_t listlen)
+ __THROW __wur;
+extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]),
+ getgroups) __wur;
+
+extern __always_inline int
+getgroups (int __size, __gid_t __list[])
+{
+ if (__bos (__list) != (size_t) -1
+ && (!__builtin_constant_p (__size)
+ || __size * sizeof (__gid_t) > __bos (__list)))
+ return __getgroups_chk (__size, __list, __bos (__list));
+ return __getgroups_alias (__size, __list);
+}
+
+
+extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
+ size_t __nreal) __THROW __nonnull ((2));
+extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf,
+ size_t __buflen), ttyname_r)
+ __nonnull ((2));
+
+extern __always_inline int
+ttyname_r (int __fd, char *__buf, size_t __buflen)
+{
+ if (__bos (__buf) != (size_t) -1
+ && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf)))
+ return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf));
+ return __ttyname_r_alias (__fd, __buf, __buflen);
+}
+
+
+#if defined __USE_REENTRANT || defined __USE_UNIX98
+extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
+ __nonnull ((1));
+extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen),
+ getlogin_r) __nonnull ((1));
+
+extern __always_inline int
+getlogin_r (char *__buf, size_t __buflen)
+{
+ if (__bos (__buf) != (size_t) -1
+ && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf)))
+ return __getlogin_r_chk (__buf, __buflen, __bos (__buf));
+ return __getlogin_r_alias (__buf, __buflen);
+}
+#endif
+
+
+#if defined __USE_BSD || defined __USE_UNIX98
+extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
+ __THROW __nonnull ((1));
+extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen),
+ gethostname) __nonnull ((1));
+
+extern __always_inline int
+gethostname (char *__buf, size_t __buflen)
+{
+ if (__bos (__buf) != (size_t) -1
+ && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf)))
+ return __gethostname_chk (__buf, __buflen, __bos (__buf));
+ return __gethostname_alias (__buf, __buflen);
+}
+#endif
+
+
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
+extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal)
+ __THROW __nonnull ((1)) __wur;
+extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf,
+ size_t __buflen),
+ getdomainname) __nonnull ((1)) __wur;
+
+extern __always_inline int
+getdomainname (char *__buf, size_t __buflen)
+{
+ if (__bos (__buf) != (size_t) -1
+ && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf)))
+ return __getdomainname_chk (__buf, __buflen, __bos (__buf));
+ return __getdomainname_alias (__buf, __buflen);
+}
+#endif
diff --git a/posix/getopt.c b/posix/getopt.c
index 9ad13a4..b1cecd3 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -576,10 +576,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -654,10 +651,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -694,10 +688,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -771,10 +762,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -837,10 +825,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -888,10 +873,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -960,10 +942,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1005,10 +984,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1047,10 +1023,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1121,10 +1094,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 2053b02..37e0679 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -774,8 +774,6 @@ re_compile_internal (preg, pattern, length, syntax)
}
preg->used = sizeof (re_dfa_t);
- __libc_lock_init (dfa->lock);
-
err = init_dfa (dfa, length);
if (BE (err != REG_NOERROR, 0))
{
@@ -789,6 +787,8 @@ re_compile_internal (preg, pattern, length, syntax)
strncpy (dfa->re_str, pattern, length + 1);
#endif
+ __libc_lock_init (dfa->lock);
+
err = re_string_construct (&regexp, pattern, length, preg->translate,
syntax & RE_ICASE, dfa);
if (BE (err != REG_NOERROR, 0))
diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c
index 91cd300..9beb881 100644
--- a/resolv/res_hconf.c
+++ b/resolv/res_hconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@azstarnet.com).
@@ -150,12 +150,7 @@ arg_service_list (const char *fname, int line_num, const char *args,
fname, line_num, start) < 0)
return 0;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
return 0;
@@ -169,12 +164,7 @@ arg_service_list (const char *fname, int line_num, const char *args,
fname, line_num, SERVICE_MAX) < 0)
return 0;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
return 0;
@@ -197,12 +187,7 @@ arg_service_list (const char *fname, int line_num, const char *args,
fname, line_num) < 0)
return 0;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
return 0;
@@ -238,14 +223,9 @@ arg_trimdomain_list (const char *fname, int line_num, const char *args,
fname, line_num, TRIMDOMAINS_MAX) < 0)
return 0;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
- free (buf);
+ free (buf);
return 0;
}
_res_hconf.trimdomain[_res_hconf.num_trimdomains++] =
@@ -264,12 +244,7 @@ arg_trimdomain_list (const char *fname, int line_num, const char *args,
fname, line_num) < 0)
return 0;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
return 0;
@@ -327,12 +302,7 @@ arg_bool (const char *fname, int line_num, const char *args, unsigned flag)
fname, line_num, args) < 0)
return 0;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
return 0;
@@ -375,12 +345,7 @@ parse_line (const char *fname, int line_num, const char *str)
fname, line_num, start) < 0)
return;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
return;
@@ -405,12 +370,7 @@ parse_line (const char *fname, int line_num, const char *str)
fname, line_num, str) < 0)
break;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
}
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 2e797e4..d860d75 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -40,7 +40,7 @@ install-others = $(inst_includedir)/bits/stdio_lim.h
include ../Makeconfig
-aux := errlist siglist printf-parsemb printf-parsewc
+aux := errlist siglist printf-parsemb printf-parsewc fxprintf
distribute := _itoa.h _itowa.h _i18n_number.h \
printf-parse.h stdio_lim.h.in tst-unbputc.sh tst-printf.sh
diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c
new file mode 100644
index 0000000..298e5f2
--- /dev/null
+++ b/stdio-common/fxprintf.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.org>.
+
+ 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 <assert.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <wchar.h>
+
+
+int
+__fxprintf (FILE *fp, const char *fmt, ...)
+{
+ if (fp == NULL)
+ fp = stderr;
+
+ va_list ap;
+ va_start (ap, fmt);
+
+ int res;
+ if (_IO_fwide (fp, 0) > 0)
+ {
+ size_t len = strlen (fmt) + 1, i;
+ wchar_t wfmt[len];
+ for (i = 0; i < len; ++i)
+ {
+ assert (isascii (fmt[i]));
+ wfmt[i] = fmt[i];
+ }
+ res = __vfwprintf (fp, wfmt, ap);
+ }
+ else
+ res = _IO_vfprintf (fp, fmt, ap);
+
+ va_end (ap);
+
+ return res;
+}
diff --git a/stdio-common/perror.c b/stdio-common/perror.c
index f075137..3ee6152 100644
--- a/stdio-common/perror.c
+++ b/stdio-common/perror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993,1997,1998,2000-2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1997,1998,2000-2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,10 +37,7 @@ perror_internal (FILE *fp, const char *s, int errnum)
errstring = __strerror_r (errnum, buf, sizeof buf);
- if (_IO_fwide (fp, 0) > 0)
- (void) __fwprintf (fp, L"%s%s%s\n", s, colon, errstring);
- else
- (void) fprintf (fp, "%s%s%s\n", s, colon, errstring);
+ (void) __fxprintf (fp, "%s%s%s\n", s, colon, errstring);
}
diff --git a/stdio-common/psignal.c b/stdio-common/psignal.c
index 2e6588c..be95095 100644
--- a/stdio-common/psignal.c
+++ b/stdio-common/psignal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2001, 2002, 2004
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2001, 2002, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -47,29 +47,16 @@ psignal (int sig, const char *s)
colon = ": ";
if (sig >= 0 && sig < NSIG && (desc = INTUSE(_sys_siglist)[sig]) != NULL)
- {
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s%s%s\n", s, colon, _(desc));
- else
- (void) fprintf (stderr, "%s%s%s\n", s, colon, _(desc));
- }
+ (void) __fxprintf (NULL, "%s%s%s\n", s, colon, _(desc));
else
{
char *buf;
if (__asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig) < 0)
- {
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s%s%s\n", s, colon, _("Unknown signal"));
- else
- (void) fprintf (stderr, "%s%s%s\n", s, colon, _("Unknown signal"));
- }
+ (void) __fxprintf (NULL, "%s%s%s\n", s, colon, _("Unknown signal"));
else
{
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", buf);
- else
- (void) fputs (buf, stderr);
+ (void) __fxprintf (NULL, "%s", buf);
free (buf);
}
diff --git a/stdlib/Makefile b/stdlib/Makefile
index fafe606..8416631 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -23,7 +23,7 @@ subdir := stdlib
headers := stdlib.h alloca.h monetary.h fmtmsg.h ucontext.h sys/ucontext.h \
inttypes.h stdint.h bits/wordsize.h bits/wchar.h \
- errno.h sys/errno.h bits/errno.h
+ errno.h sys/errno.h bits/errno.h bits/stdlib.h
routines := \
atof atoi atol atoll \
diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h
new file mode 100644
index 0000000..7ca6c86
--- /dev/null
+++ b/stdlib/bits/stdlib.h
@@ -0,0 +1,75 @@
+/* Checking macros for stdlib functions.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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. */
+
+#ifndef _STDLIB_H
+# error "Never include <bits/stdlib.h> directly; use <stdlib.h> instead."
+#endif
+
+extern char *__realpath_chk (__const char *__restrict __name,
+ char *__restrict __resolved,
+ size_t __resolvedlen) __THROW __wur;
+extern char *__REDIRECT_NTH (__realpath_alias,
+ (__const char *__restrict __name,
+ char *__restrict __resolved), realpath) __wur;
+
+extern __always_inline __wur char *
+realpath (const char *__name, char *__resolved)
+{
+ if (__bos (__resolved) != (size_t) -1)
+ return __realpath_chk (__name, __resolved, __bos (__resolved));
+
+ return __realpath_alias (__name, __resolved);
+}
+
+
+extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
+ size_t __nreal) __THROW __nonnull ((2));
+extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf,
+ size_t __buflen), ptsname_r)
+ __nonnull ((2));
+
+extern __always_inline int
+ptsname_r (int __fd, char *__buf, size_t __buflen)
+{
+ if (__bos (__buf) != (size_t) -1
+ && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf)))
+ return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf));
+ return __ptsname_r_alias (__fd, __buf, __buflen);
+}
+
+
+extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen)
+ __THROW __wur;
+extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar),
+ wctomb) __wur;
+
+extern __always_inline __wur int
+wctomb (char *__s, wchar_t __wchar)
+{
+ /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
+ But this would only disturb the namespace. So we define our own
+ version here. */
+#define __STDLIB_MB_LEN_MAX 16
+#if defined MB_LEN_MAX && MB_LEN_MAX != __STDLIB_MB_LEN_MAX
+# error "Assumed value of MB_LEN_MAX wrong"
+#endif
+ if (__bos (__s) != (size_t) -1 && __STDLIB_MB_LEN_MAX > __bos (__s))
+ return __wctomb_chk (__s, __wchar, __bos (__s));
+ return __wctomb_alias (__s, __wchar);
+}
diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c
index b5d7436..e0f4061 100644
--- a/stdlib/fmtmsg.c
+++ b/stdlib/fmtmsg.c
@@ -154,42 +154,21 @@ fmtmsg (long int classification, const char *label, int severity,
int do_action = (print & action_mask) && action != MM_NULLACT;
int do_tag = (print & tag_mask) && tag != MM_NULLTAG;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- {
- if (__fwprintf (stderr, L"%s%s%s%s%s%s%s%s%s%s\n",
- do_label ? label : "",
- do_label
- && (do_severity | do_text | do_action | do_tag)
- ? ": " : "",
- do_severity ? severity_rec->string : "",
- do_severity && (do_text | do_action | do_tag)
- ? ": " : "",
- do_text ? text : "",
- do_text && (do_action | do_tag) ? "\n" : "",
- do_action ? "TO FIX: " : "",
- do_action ? action : "",
- do_action && do_tag ? " " : "",
- do_tag ? tag : "") < 0)
- /* Oh, oh. An error occurred during the output. */
- result = MM_NOMSG;
- }
- else
-#endif
- if (fprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
- do_label ? label : "",
- do_label && (do_severity | do_text | do_action | do_tag)
- ? ": " : "",
- do_severity ? severity_rec->string : "",
- do_severity && (do_text | do_action | do_tag) ? ": " : "",
- do_text ? text : "",
- do_text && (do_action | do_tag) ? "\n" : "",
- do_action ? "TO FIX: " : "",
- do_action ? action : "",
- do_action && do_tag ? " " : "",
- do_tag ? tag : "") < 0)
- /* Oh, oh. An error occurred during the output. */
- result = MM_NOMSG;
+ if (__fxprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
+ do_label ? label : "",
+ do_label && (do_severity | do_text | do_action | do_tag)
+ ? ": " : "",
+ do_severity ? severity_rec->string : "",
+ do_severity && (do_text | do_action | do_tag)
+ ? ": " : "",
+ do_text ? text : "",
+ do_text && (do_action | do_tag) ? "\n" : "",
+ do_action ? "TO FIX: " : "",
+ do_action ? action : "",
+ do_action && do_tag ? " " : "",
+ do_tag ? tag : "") < 0)
+ /* Oh, oh. An error occurred during the output. */
+ result = MM_NOMSG;
}
if (classification & MM_CONSOLE)
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 4a1571e..bff7722 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -618,7 +618,7 @@ extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
#ifdef __USE_XOPEN2K
/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
- __THROW __attribute_malloc__ __nonnull ((1)) __wur;
+ __THROW __nonnull ((1)) __wur;
#endif
__BEGIN_NAMESPACE_STD
@@ -961,6 +961,12 @@ extern int getloadavg (double __loadavg[], int __nelem)
__THROW __nonnull ((1));
#endif
+
+/* Define some macros helping to catch buffer overflows. */
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+# include <bits/stdlib.h>
+#endif
+
#endif /* don't just need malloc and calloc */
#undef __need_malloc_and_calloc
diff --git a/string/bits/string3.h b/string/bits/string3.h
index bcda42a..8da73ff 100644
--- a/string/bits/string3.h
+++ b/string/bits/string3.h
@@ -144,6 +144,22 @@ __strncpy_ichk (char *__restrict __dest, const char *__restrict __src,
}
+// XXX We have no corresponding builtin yet.
+extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n,
+ size_t __destlen) __THROW;
+extern char *__REDIRECT (__stpncpy_alias, (char *__dest, const char *__src,
+ size_t __n), stpncpy) __THROW;
+
+extern __always_inline char *
+stpncpy (char *__dest, const char *__src, size_t __n)
+{
+ if (__bos (__dest) != (size_t) -1
+ && (!__builtin_constant_p (__n) || __n <= __bos (__dest)))
+ return __stpncpy_chk (__dest, __src, __n, __bos (__dest));
+ return __stpncpy_alias (__dest, __src, __n);
+}
+
+
#define strcat(dest, src) \
((__bos (dest) != (size_t) -1) \
? __builtin___strcat_chk (dest, src, __bos (dest)) \
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c
index 1cf18cb..c5a874b 100644
--- a/sunrpc/auth_unix.c
+++ b/sunrpc/auth_unix.c
@@ -111,13 +111,7 @@ authunix_create (char *machname, uid_t uid, gid_t gid, int len,
if (auth == NULL || au == NULL)
{
no_memory:
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("authunix_create: out of memory\n"));
- else
-#endif
- (void) fputs (_("authunix_create: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("authunix_create: out of memory\n"));
mem_free (auth, sizeof (*auth));
mem_free (au, sizeof (*au));
return NULL;
diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c
index 4fa5e62..6446b32 100644
--- a/sunrpc/clnt_perr.c
+++ b/sunrpc/clnt_perr.c
@@ -155,12 +155,7 @@ libc_hidden_def (clnt_sperror)
void
clnt_perror (CLIENT * rpch, const char *msg)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", clnt_sperror (rpch, msg));
- else
-#endif
- (void) fputs (clnt_sperror (rpch, msg), stderr);
+ (void) __fxprintf (NULL, "%s", clnt_sperror (rpch, msg));
}
libc_hidden_def (clnt_perror)
@@ -289,12 +284,7 @@ libc_hidden_def (clnt_sperrno)
void
clnt_perrno (enum clnt_stat num)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", clnt_sperrno (num));
- else
-#endif
- (void) fputs (clnt_sperrno (num), stderr);
+ (void) __fxprintf (NULL, "%s", clnt_sperrno (num));
}
@@ -337,12 +327,7 @@ libc_hidden_def (clnt_spcreateerror)
void
clnt_pcreateerror (const char *msg)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", clnt_spcreateerror (msg));
- else
-#endif
- (void) fputs (clnt_spcreateerror (msg), stderr);
+ (void) __fxprintf (NULL, "%s", clnt_spcreateerror (msg));
}
struct auth_errtab
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index 5d02cd9..095baa8 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -128,13 +128,7 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
if (h == NULL || ct == NULL)
{
struct rpc_createerr *ce = &get_rpc_createerr ();
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("clnttcp_create: out of memory\n"));
- else
-#endif
- (void) fputs (_("clnttcp_create: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("clnttcp_create: out of memory\n"));
ce->cf_stat = RPC_SYSTEMERROR;
ce->cf_error.re_errno = ENOMEM;
goto fooy;
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index f3787dd..f4a46b5 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -136,13 +136,7 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
if (cl == NULL || cu == NULL)
{
struct rpc_createerr *ce = &get_rpc_createerr ();
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("clntudp_create: out of memory\n"));
- else
-#endif
- (void) fputs (_("clntudp_create: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("clntudp_create: out of memory\n"));
ce->cf_stat = RPC_SYSTEMERROR;
ce->cf_error.re_errno = ENOMEM;
goto fooy;
diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index fae1cd8..4e93e0d 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -125,13 +125,7 @@ clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers,
if (h == NULL || ct == NULL)
{
struct rpc_createerr *ce = &get_rpc_createerr ();
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("clntunix_create: out of memory\n"));
- else
-#endif
- (void) fputs (_("clntunix_create: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("clntunix_create: out of memory\n"));
ce->cf_stat = RPC_SYSTEMERROR;
ce->cf_error.re_errno = ENOMEM;
goto fooy;
diff --git a/sunrpc/svc_simple.c b/sunrpc/svc_simple.c
index 5ac21ff..6c1c9c9 100644
--- a/sunrpc/svc_simple.c
+++ b/sunrpc/svc_simple.c
@@ -125,12 +125,7 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum,
err_out:
if (buf == NULL)
return -1;
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", buf);
- else
-#endif
- (void) fputs (buf, stderr);
+ (void) __fxprintf (NULL, "%s", buf);
free (buf);
return -1;
}
@@ -189,12 +184,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l)
err_out2:
if (buf == NULL)
exit (1);
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
free (buf);
exit (1);
}
diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
index 873d39d..539a2b8 100644
--- a/sunrpc/svc_tcp.c
+++ b/sunrpc/svc_tcp.c
@@ -176,12 +176,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
if (r == NULL || xprt == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", _("svctcp_create: out of memory\n"));
- else
-#endif
- (void) fputs (_("svctcp_create: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("svctcp_create: out of memory\n"));
mem_free (r, sizeof (*r));
mem_free (xprt, sizeof (SVCXPRT));
return NULL;
@@ -219,13 +214,8 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize)
cd = (struct tcp_conn *) mem_alloc (sizeof (struct tcp_conn));
if (xprt == (SVCXPRT *) NULL || cd == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("svc_tcp: makefd_xprt: out of memory\n"));
- else
-#endif
- (void) fputs (_("svc_tcp: makefd_xprt: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s",
+ _("svc_tcp: makefd_xprt: out of memory\n"));
mem_free (xprt, sizeof (SVCXPRT));
mem_free (cd, sizeof (struct tcp_conn));
return NULL;
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 45f9944..c0c115a 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -149,12 +149,7 @@ svcudp_bufcreate (sock, sendsz, recvsz)
buf = mem_alloc (((MAX (sendsz, recvsz) + 3) / 4) * 4);
if (xprt == NULL || su == NULL || buf == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n"));
- else
-#endif
- (void) fputs (_("svcudp_create: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("svcudp_create: out of memory\n"));
mem_free (xprt, sizeof (SVCXPRT));
mem_free (su, sizeof (*su));
mem_free (buf, ((MAX (sendsz, recvsz) + 3) / 4) * 4);
@@ -176,14 +171,8 @@ svcudp_bufcreate (sock, sendsz, recvsz)
+ sizeof(struct cmsghdr) + sizeof (struct in_pktinfo))
> sizeof (xprt->xp_pad))
{
-# ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
- else
-# endif
- (void) fputs (_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"),
- stderr);
+ (void) __fxprintf (NULL,"%s", _("\
+svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
return NULL;
}
pad = 1;
@@ -411,16 +400,8 @@ svcudp_destroy (xprt)
#define SPARSENESS 4 /* 75% sparse */
-#ifdef USE_IN_LIBIO
-# define CACHE_PERROR(msg) \
- if (_IO_fwide (stderr, 0) > 0) \
- (void) __fwprintf(stderr, L"%s\n", msg); \
- else \
- (void) fprintf(stderr, "%s\n", msg)
-#else
-# define CACHE_PERROR(msg) \
- (void) fprintf(stderr,"%s\n", msg)
-#endif
+#define CACHE_PERROR(msg) \
+ (void) __fxprintf(NULL, "%s\n", msg)
#define ALLOC(type, size) \
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
index d95e884..1b7b1fb 100644
--- a/sunrpc/svc_unix.c
+++ b/sunrpc/svc_unix.c
@@ -173,12 +173,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path)
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
if (r == NULL || xprt == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", _("svcunix_create: out of memory\n"));
- else
-#endif
- fputs (_("svcunix_create: out of memory\n"), stderr);
+ __fxprintf (NULL, "%s", _("svcunix_create: out of memory\n"));
mem_free (r, sizeof (*r));
mem_free (xprt, sizeof (SVCXPRT));
return NULL;
@@ -216,13 +211,8 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize)
cd = (struct unix_conn *) mem_alloc (sizeof (struct unix_conn));
if (xprt == (SVCXPRT *) NULL || cd == (struct unix_conn *) NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("svc_unix: makefd_xprt: out of memory\n"));
- else
-#endif
- (void) fputs (_("svc_unix: makefd_xprt: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s",
+ _("svc_unix: makefd_xprt: out of memory\n"));
mem_free (xprt, sizeof (SVCXPRT));
mem_free (cd, sizeof (struct unix_conn));
return NULL;
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index 1f25e3e..21e339b 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -563,12 +563,7 @@ xdr_bytes (xdrs, cpp, sizep, maxsize)
}
if (sp == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", _("xdr_bytes: out of memory\n"));
- else
-#endif
- (void) fputs (_("xdr_bytes: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("xdr_bytes: out of memory\n"));
return FALSE;
}
/* fall into ... */
@@ -720,13 +715,7 @@ xdr_string (xdrs, cpp, maxsize)
*cpp = sp = (char *) mem_alloc (nodesize);
if (sp == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("xdr_string: out of memory\n"));
- else
-#endif
- (void) fputs (_("xdr_string: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("xdr_string: out of memory\n"));
return FALSE;
}
sp[size] = 0;
diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c
index 9f67e7f..765f899 100644
--- a/sunrpc/xdr_array.c
+++ b/sunrpc/xdr_array.c
@@ -105,13 +105,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
*addrp = target = mem_alloc (nodesize);
if (target == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("xdr_array: out of memory\n"));
- else
-#endif
- (void) fputs (_("xdr_array: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("xdr_array: out of memory\n"));
return FALSE;
}
__bzero (target, nodesize);
diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c
index 5e59c88..1be3a4a 100644
--- a/sunrpc/xdr_rec.c
+++ b/sunrpc/xdr_rec.c
@@ -153,12 +153,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize,
if (rstrm == NULL || buf == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", _("xdrrec_create: out of memory\n"));
- else
-#endif
- (void) fputs (_("xdrrec_create: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("xdrrec_create: out of memory\n"));
mem_free (rstrm, sizeof (RECSTREAM));
mem_free (buf, sendsize + recvsize + BYTES_PER_XDR_UNIT);
/*
diff --git a/sunrpc/xdr_ref.c b/sunrpc/xdr_ref.c
index ab706d7..961c82e 100644
--- a/sunrpc/xdr_ref.c
+++ b/sunrpc/xdr_ref.c
@@ -82,13 +82,8 @@ xdr_reference (xdrs, pp, size, proc)
*pp = loc = (caddr_t) mem_alloc (size);
if (loc == NULL)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("xdr_reference: out of memory\n"));
- else
-#endif
- (void) fputs (_("xdr_reference: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s",
+ _("xdr_reference: out of memory\n"));
return FALSE;
}
__bzero (loc, (int) size);
diff --git a/sysdeps/alpha/fpu/feholdexcpt.c b/sysdeps/alpha/fpu/feholdexcpt.c
index 77d4cc1..79aa970 100644
--- a/sysdeps/alpha/fpu/feholdexcpt.c
+++ b/sysdeps/alpha/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>, 1997
@@ -31,3 +31,4 @@ feholdexcept (fenv_t *envp)
return 0;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/alpha/fpu/fesetround.c b/sysdeps/alpha/fpu/fesetround.c
index c4dc196..54b2bcf 100644
--- a/sysdeps/alpha/fpu/fesetround.c
+++ b/sysdeps/alpha/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>, 1997
@@ -40,3 +40,4 @@ fesetround (int round)
return 0;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/generic/clock_gettime.c b/sysdeps/generic/clock_gettime.c
index 85bb79c..ff30612 100644
--- a/sysdeps/generic/clock_gettime.c
+++ b/sysdeps/generic/clock_gettime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,5 +26,6 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
__set_errno (ENOSYS);
return -1;
}
+librt_hidden_def (clock_gettime)
stub_warning (clock_gettime)
#include <stub-tag.h>
diff --git a/sysdeps/generic/feholdexcpt.c b/sysdeps/generic/feholdexcpt.c
index 927a6dc..8680d1e 100644
--- a/sysdeps/generic/feholdexcpt.c
+++ b/sysdeps/generic/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -25,5 +25,6 @@ feholdexcept (fenv_t *envp)
{
return 1; /* Signal failure. */
}
+libm_hidden_def (feholdexcept)
stub_warning (feholdexcept)
#include <stub-tag.h>
diff --git a/sysdeps/generic/fesetround.c b/sysdeps/generic/fesetround.c
index e5a27d2..5b14826 100644
--- a/sysdeps/generic/fesetround.c
+++ b/sysdeps/generic/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -25,5 +25,6 @@ fesetround (int round)
{
return 1; /* Signal we are unable to set the direction. */
}
+libm_hidden_def (fesetround)
stub_warning (fesetround)
#include <stub-tag.h>
diff --git a/sysdeps/generic/s_significand.c b/sysdeps/generic/s_significand.c
index 4ab078c..f95b648 100644
--- a/sysdeps/generic/s_significand.c
+++ b/sysdeps/generic/s_significand.c
@@ -30,7 +30,7 @@ static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Ex
double x;
#endif
{
- return __ieee754_scalb(x,(double) -ilogb(x));
+ return __ieee754_scalb(x,(double) -__ilogb(x));
}
weak_alias (__significand, significand)
#ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/generic/s_significandf.c b/sysdeps/generic/s_significandf.c
index 2893a4e..cf5eb59 100644
--- a/sysdeps/generic/s_significandf.c
+++ b/sysdeps/generic/s_significandf.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -27,6 +27,6 @@ static char rcsid[] = "$NetBSD: s_significandf.c,v 1.3 1995/05/10 20:48:13 jtc E
float x;
#endif
{
- return __ieee754_scalbf(x,(float) -ilogbf(x));
+ return __ieee754_scalbf(x,(float) -__ilogbf(x));
}
weak_alias (__significandf, significandf)
diff --git a/sysdeps/generic/stpncpy_chk.c b/sysdeps/generic/stpncpy_chk.c
new file mode 100644
index 0000000..d136339
--- /dev/null
+++ b/sysdeps/generic/stpncpy_chk.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 1993,1995,1996,1997,2002,2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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. */
+
+/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
+
+#include <string.h>
+
+
+/* Copy no more than N characters of SRC to DEST, returning the address of
+ the terminating '\0' in DEST, if any, or else DEST + N. */
+char *
+__stpncpy_chk (char *dest, const char *src, size_t n, size_t destlen)
+{
+ char c;
+ char *s = dest;
+
+ if (__builtin_expect (destlen < n, 0))
+ __chk_fail ();
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+
+ for (;;)
+ {
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ if (--n4 == 0)
+ goto last_chars;
+ }
+ n -= dest - s;
+ goto zero_fill;
+ }
+
+ last_chars:
+ n &= 3;
+ if (n == 0)
+ return dest;
+
+ for (;;)
+ {
+ c = *src++;
+ --n;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ if (n == 0)
+ return dest;
+ }
+
+ zero_fill:
+ while (n-- > 0)
+ dest[n] = '\0';
+
+ return dest - 1;
+}
diff --git a/sysdeps/generic/wordexp.c b/sysdeps/generic/wordexp.c
index 06d38f6..2eb5808 100644
--- a/sysdeps/generic/wordexp.c
+++ b/sysdeps/generic/wordexp.c
@@ -1798,12 +1798,7 @@ envsubst:
if (str[0] == '\0')
str = _("parameter null or not set");
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s: %s\n", env, str);
- else
-#endif
- fprintf (stderr, "%s: %s\n", env, str);
+ __fxprintf (NULL, "%s: %s\n", env, str);
}
if (free_value)
diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c
index 5509686..feaa24b 100644
--- a/sysdeps/i386/fpu/feholdexcpt.c
+++ b/sysdeps/i386/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997, 1999, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -51,3 +51,4 @@ feholdexcept (fenv_t *envp)
return 0;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c
index 2746f3e..a868f27 100644
--- a/sysdeps/i386/fpu/fesetround.c
+++ b/sysdeps/i386/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -50,3 +50,4 @@ fesetround (int round)
return 0;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/ia64/fpu/feholdexcpt.c b/sysdeps/ia64/fpu/feholdexcpt.c
index fd13de6..27c9a11 100644
--- a/sysdeps/ia64/fpu/feholdexcpt.c
+++ b/sysdeps/ia64/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999
@@ -31,3 +31,4 @@ feholdexcept (fenv_t *envp)
return 1;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/ia64/fpu/fesetround.c b/sysdeps/ia64/fpu/fesetround.c
index 26a6be4..351bcc2 100644
--- a/sysdeps/ia64/fpu/fesetround.c
+++ b/sysdeps/ia64/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
@@ -39,3 +39,4 @@ fesetround (int round)
return 1;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index f0542c5..e946f9f 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -1,5 +1,5 @@
/* Compute sine and cosine of argument.
- Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -40,8 +40,8 @@ __sincos (double x, double *sinx, double *cosx)
}
else
{
- *sinx = sin (x);
- *cosx = cos (x);
+ *sinx = __sin (x);
+ *cosx = __cos (x);
}
}
weak_alias (__sincos, sincos)
diff --git a/sysdeps/ieee754/flt-32/e_atan2f.c b/sysdeps/ieee754/flt-32/e_atan2f.c
index 8b3398c..c0cafb1 100644
--- a/sysdeps/ieee754/flt-32/e_atan2f.c
+++ b/sysdeps/ieee754/flt-32/e_atan2f.c
@@ -30,7 +30,7 @@ zero = 0.0,
pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */
pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */
pi = 3.1415927410e+00, /* 0x40490fdb */
-pi_lo = -8.7422776573e-07; /* 0xb3bbbd2e */
+pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
#ifdef __STDC__
float __ieee754_atan2f(float y, float x)
diff --git a/sysdeps/powerpc/fpu/feholdexcpt.c b/sysdeps/powerpc/fpu/feholdexcpt.c
index 8ac875c..150becd 100644
--- a/sysdeps/powerpc/fpu/feholdexcpt.c
+++ b/sysdeps/powerpc/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -36,3 +36,4 @@ feholdexcept (fenv_t *envp)
return 0;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/powerpc/fpu/fesetround.c b/sysdeps/powerpc/fpu/fesetround.c
index f7cd6af..67518d0 100644
--- a/sysdeps/powerpc/fpu/fesetround.c
+++ b/sysdeps/powerpc/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -39,3 +39,4 @@ fesetround (int round)
return 0;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 850a107..1ea3b60 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -2,17 +2,14 @@
# atan2
Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
float: 1
ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
# atanh
Test "atanh (0.75) == 0.972955074527656652552676371721589865":
@@ -623,8 +620,8 @@ idouble: 1
# Maximal error of functions:
Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
Function: "atanh":
float: 1
diff --git a/sysdeps/s390/fpu/feholdexcpt.c b/sysdeps/s390/fpu/feholdexcpt.c
index 7fd7ea5..dee44dc 100644
--- a/sysdeps/s390/fpu/feholdexcpt.c
+++ b/sysdeps/s390/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
@@ -32,3 +32,4 @@ int feholdexcept (fenv_t *envp)
_FPU_SETCW ((envp->fpc & ~(FE_ALL_EXCEPT << FPC_EXCEPTION_MASK_SHIFT)));
return 0;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/s390/fpu/fesetround.c b/sysdeps/s390/fpu/fesetround.c
index 5f510fe..d99f1db 100644
--- a/sysdeps/s390/fpu/fesetround.c
+++ b/sysdeps/s390/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
@@ -35,3 +35,4 @@ fesetround (int round)
return 0;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index cfade82..552ad4a 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -2,17 +2,14 @@
# atan2
Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
float: 1
ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
# atanh
Test "atanh (0.75) == 0.972955074527656652552676371721589865":
@@ -664,8 +661,8 @@ idouble: 1
# Maximal error of functions:
Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
Function: "atanh":
float: 1
diff --git a/sysdeps/s390/s390-64/bcopy.S b/sysdeps/s390/s390-64/bcopy.S
index ff79667..abcb1fb 100644
--- a/sysdeps/s390/s390-64/bcopy.S
+++ b/sysdeps/s390/s390-64/bcopy.S
@@ -1,6 +1,6 @@
/* bcopy -- copy a block from source to destination. 64 bit S/390 version.
This file is part of the GNU C Library.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
The GNU C Library is free software; you can redistribute it and/or
@@ -59,14 +59,10 @@ ENTRY(__bcopy)
jo .L6
br %r14
.L7: # destructive overlay, can not use mvcle
- lgr %r1,%r2 # bcopy is called with source,dest
- lgr %r2,%r3 # memmove with dest,source! Oh, well...
- lgr %r3,%r1
-#ifdef PIC
- jg memmove@PLT
-#else
- jg memmove
-#endif
+ lgr %r1,%r2 # bcopy is called with source,dest
+ lgr %r2,%r3 # memmove with dest,source! Oh, well...
+ lgr %r3,%r1
+ jg HIDDEN_BUILTIN_JUMPTARGET(memmove)
END(__bcopy)
diff --git a/sysdeps/sh/sh4/fpu/feholdexcpt.c b/sysdeps/sh/sh4/fpu/feholdexcpt.c
index dafb4f7..7aac5a0 100644
--- a/sysdeps/sh/sh4/fpu/feholdexcpt.c
+++ b/sysdeps/sh/sh4/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -35,3 +35,4 @@ feholdexcept (fenv_t *envp)
return 1;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/sh/sh4/fpu/fesetround.c b/sysdeps/sh/sh4/fpu/fesetround.c
index 9966838..cf43490 100644
--- a/sysdeps/sh/sh4/fpu/fesetround.c
+++ b/sysdeps/sh/sh4/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
@@ -41,3 +41,4 @@ fesetround (int round)
return 1;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/sparc/fpu/feholdexcpt.c b/sysdeps/sparc/fpu/feholdexcpt.c
index 3bd2b16..729637a 100644
--- a/sysdeps/sparc/fpu/feholdexcpt.c
+++ b/sysdeps/sparc/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,3 +33,4 @@ feholdexcept (fenv_t *envp)
return 0;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/sparc/fpu/fesetround.c b/sysdeps/sparc/fpu/fesetround.c
index b18b344..e3b441c 100644
--- a/sysdeps/sparc/fpu/fesetround.c
+++ b/sysdeps/sparc/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -35,3 +35,4 @@ fesetround (int round)
return 0;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index 8f82ac8..f698f01 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -131,3 +131,4 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
return retval;
}
+librt_hidden_def (clock_gettime)
diff --git a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
index ee19161..39511cd 100644
--- a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
+++ b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
-
+#include <not-cancel.h>
static int itc_usable;
@@ -31,18 +31,18 @@ has_cpuclock (void)
if (__builtin_expect (itc_usable == 0, 0))
{
int newval = 1;
- int fd = open ("/proc/sal/itc_drift", O_RDONLY);
+ int fd = open_not_cancel_2 ("/proc/sal/itc_drift", O_RDONLY);
if (__builtin_expect (fd != -1, 1))
{
char buf[16];
/* We expect the file to contain a single digit followed by
a newline. If the format changes we better not rely on
the file content. */
- if (read (fd, buf, sizeof buf) != 2 || buf[0] != '0'
- || buf[1] != '\n')
+ if (read_not_cancel (fd, buf, sizeof buf) != 2
+ || buf[0] != '0' || buf[1] != '\n')
newval = -1;
- close (fd);
+ close_not_cancel_no_status (fd);
}
itc_usable = newval;
diff --git a/sysdeps/x86_64/fpu/feholdexcpt.c b/sysdeps/x86_64/fpu/feholdexcpt.c
index db53d0f..a9b21a3 100644
--- a/sysdeps/x86_64/fpu/feholdexcpt.c
+++ b/sysdeps/x86_64/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -39,3 +39,4 @@ feholdexcept (fenv_t *envp)
return 0;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/x86_64/fpu/fesetround.c b/sysdeps/x86_64/fpu/fesetround.c
index 429b7f1..408116e 100644
--- a/sysdeps/x86_64/fpu/fesetround.c
+++ b/sysdeps/x86_64/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -44,3 +44,4 @@ fesetround (int round)
return 0;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index b3ce8bf..425549d 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -24,17 +24,14 @@ ldouble: 1
# atan2
Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
float: 1
ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
# atanh
Test "atanh (0.75) == 0.972955074527656652552676371721589865":
@@ -953,8 +950,8 @@ ildouble: 1
ldouble: 1
Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
Function: "atanh":
float: 1
diff --git a/sysdeps/x86_64/fpu/s_sincos.S b/sysdeps/x86_64/fpu/s_sincos.S
new file mode 100644
index 0000000..9a33615
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_sincos.S
@@ -0,0 +1,61 @@
+/* Compute sine and cosine of argument.
+ Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE /* no space for saved regs */
+#define ANGLE PARMS
+#define SINP ANGLE+12
+#define COSP SINP+PTR_SIZE
+
+ .text
+ENTRY (BP_SYM (__sincos))
+ ENTER
+
+ movsd %xmm0, -8(%rsp)
+ fldl -8(%rsp)
+ fsincos
+ fnstsw %ax
+ testl $0x400,%eax
+ jnz 1f
+ fstpl (%rsi)
+ fstpl (%rdi)
+
+ LEAVE
+ retq
+
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ testl $0x400,%eax
+ jnz 2b
+ fstp %st(1)
+ fsincos
+ fstpl (%rsi)
+ fstpl (%rdi)
+
+ LEAVE
+ retq
+END (BP_SYM (__sincos))
+weak_alias (BP_SYM (__sincos), BP_SYM (sincos))
diff --git a/sysdeps/x86_64/fpu/s_sincosl.S b/sysdeps/x86_64/fpu/s_sincosl.S
index 9a3025a..b17eabe 100644
--- a/sysdeps/x86_64/fpu/s_sincosl.S
+++ b/sysdeps/x86_64/fpu/s_sincosl.S
@@ -1,5 +1,5 @@
/* Compute sine and cosine of argument.
- Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -40,9 +40,8 @@ ENTRY (BP_SYM (__sincosl))
fstpt (%rdi)
LEAVE
- ret
+ retq
- .align ALIGNARG(4)
1: fldpi
fadd %st(0)
fxch %st(1)
@@ -56,6 +55,6 @@ ENTRY (BP_SYM (__sincosl))
fstpt (%rdi)
LEAVE
- ret
+ retq
END (BP_SYM (__sincosl))
weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl))
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
new file mode 100644
index 0000000..c102948
--- /dev/null
+++ b/wcsmbs/bits/wchar2.h
@@ -0,0 +1,398 @@
+/* Checking macros for wchar functions.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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. */
+
+#ifndef _WCHAR_H
+# error "Never include <bits/wchar.h> directly; use <wchar.h> instead."
+#endif
+
+
+extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1,
+ __const wchar_t *__restrict __s2, size_t __n,
+ size_t __ns1) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias,
+ (wchar_t *__restrict __s1,
+ __const wchar_t *__restrict __s2, size_t __n),
+ wmemcpy);
+
+extern __always_inline wchar_t *
+wmemcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
+ size_t __n)
+{
+ if (__bos0 (__s1) != (size_t) -1)
+ return __wmemcpy_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t));
+ return __wmemcpy_alias (__s1, __s2, __n);
+}
+
+
+extern wchar_t *__wmemmove_chk (wchar_t *__s1, __const wchar_t *__s2,
+ size_t __n, size_t __ns1) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1,
+ __const wchar_t *__s2,
+ size_t __n), wmemmove);
+
+extern __always_inline wchar_t *
+wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
+ size_t __n)
+{
+ if (__bos0 (__s1) != (size_t) -1)
+ return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t));
+ return __wmemmove_alias (__s1, __s2, __n);
+}
+
+
+#ifdef __USE_GNU
+extern wchar_t *__wmempcpy_chk (wchar_t *__restrict __s1,
+ __const wchar_t *__restrict __s2, size_t __n,
+ size_t __ns1) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias,
+ (wchar_t *__restrict __s1,
+ __const wchar_t *__restrict __s2,
+ size_t __n), wmempcpy);
+
+extern __always_inline wchar_t *
+wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
+ size_t __n)
+{
+ if (__bos0 (__s1) != (size_t) -1)
+ return __wmempcpy_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t));
+ return __wmempcpy_alias (__s1, __s2, __n);
+}
+#endif
+
+
+extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
+ size_t __ns) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c,
+ size_t __n), wmemset);
+
+extern __always_inline wchar_t *
+wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n)
+{
+ if (__bos0 (__s) != (size_t) -1)
+ return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
+ return __wmemset_alias (__s, __c, __n);
+}
+
+
+extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src,
+ size_t __n) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wcscpy_alias,
+ (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src), wcscpy);
+
+extern __always_inline wchar_t *
+wcscpy (wchar_t *__dest, __const wchar_t *__src)
+{
+ if (__bos (__dest) != (size_t) -1)
+ return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
+ return __wcscpy_alias (__dest, __src);
+}
+
+
+extern wchar_t *__wcpcpy_chk (wchar_t *__dest, __const wchar_t *__src,
+ size_t __destlen) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__dest,
+ __const wchar_t *__src),
+ wcpcpy);
+
+extern __always_inline wchar_t *
+wcpcpy (wchar_t *__dest, __const wchar_t *__src)
+{
+ if (__bos (__dest) != (size_t) -1)
+ return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
+ return __wcpcpy_alias (__dest, __src);
+}
+
+
+extern wchar_t *__wcsncpy_chk (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src, size_t __n,
+ size_t __destlen) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias,
+ (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src,
+ size_t __n), wcsncpy);
+
+extern __always_inline wchar_t *
+wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
+{
+ if (__bos (__dest) != (size_t) -1
+ && (!__builtin_constant_p (__n) || __bos (__dest) >= __n))
+ return __wcsncpy_chk (__dest, __src, __n,
+ __bos (__dest) / sizeof (wchar_t));
+ return __wcsncpy_alias (__dest, __src, __n);
+}
+
+
+extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src, size_t __n,
+ size_t __destlen) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias,
+ (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src,
+ size_t __n), wcpncpy);
+
+extern __always_inline wchar_t *
+wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
+{
+ if (__bos (__dest) != (size_t) -1
+ && (!__builtin_constant_p (__n) || __bos (__dest) >= __n))
+ return __wcpncpy_chk (__dest, __src, __n,
+ __bos (__dest) / sizeof (wchar_t));
+ return __wcpncpy_alias (__dest, __src, __n);
+}
+
+
+extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src,
+ size_t __destlen) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wcscat_alias,
+ (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src), wcscat);
+
+extern __always_inline wchar_t *
+wcscat (wchar_t *__dest, __const wchar_t *__src)
+{
+ if (__bos (__dest) != (size_t) -1)
+ return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
+ return __wcscat_alias (__dest, __src);
+}
+
+
+extern wchar_t *__wcsncat_chk (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src,
+ size_t __n, size_t __destlen) __THROW;
+extern wchar_t *__REDIRECT_NTH (__wcsncat_alias,
+ (wchar_t *__restrict __dest,
+ __const wchar_t *__restrict __src,
+ size_t __n), wcsncat);
+
+extern __always_inline wchar_t *
+wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n)
+{
+ if (__bos (__dest) != (size_t) -1)
+ return __wcsncat_chk (__dest, __src, __n,
+ __bos (__dest) / sizeof (wchar_t));
+ return __wcsncat_alias (__dest, __src, __n);
+}
+
+
+extern int __swprintf_chk (wchar_t *__restrict __s, size_t __n,
+ int __flag, size_t __s_len,
+ __const wchar_t *__restrict __format, ...)
+ __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 6))) */;
+
+/* XXX We might want to have support in gcc for swprintf. */
+#define swprintf(s, n, format, ...) \
+ (__bos (s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1 \
+ ? __swprintf_chk (s, n, __USE_FORTIFY_LEVEL - 1, __bos (s), format, \
+ __VA_ARGS__) \
+ : swprintf (s, n, format, __VA_ARGS__))
+
+
+extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
+ int __flag, size_t __s_len,
+ __const wchar_t *__restrict __format,
+ __gnuc_va_list __arg)
+ __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
+extern int __REDIRECT_NTH (__vswprintf_alias,
+ (wchar_t *__restrict __s, size_t __n,
+ __const wchar_t *__restrict __format,
+ __gnuc_va_list __arg), vswprintf)
+ /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+
+
+extern __always_inline int
+vswprintf (wchar_t *__s, size_t __n, __const wchar_t *__format,
+ __gnuc_va_list __arg)
+{
+ if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
+ return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s),
+ __format, __arg);
+ return vswprintf (__s, __n, __format, __arg);
+}
+
+
+#if __USE_FORTIFY_LEVEL > 1
+
+extern int __fwprintf_chk (FILE *__restrict __stream, int __flag,
+ __const wchar_t *__restrict __format, ...);
+extern int __wprintf_chk (int __flag, __const wchar_t *__restrict __format,
+ ...);
+extern int __vfwprintf_chk (FILE *__restrict __stream, int __flag,
+ __const wchar_t *__restrict __format,
+ _G_va_list __ap);
+extern int __vwprintf_chk (int __flag, __const wchar_t *__restrict __format,
+ _G_va_list __ap);
+
+# define wprintf(...) \
+ __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+# define fwprintf(stream, ...) \
+ __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+# define vwprintf(format, ap) \
+ __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, format, ap)
+# define vfwprintf(stream, format, ap) \
+ __vfwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, format, ap)
+
+#endif
+
+extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n,
+ FILE *__restrict __stream) __wur;
+extern wchar_t *__REDIRECT (__fgetws_alias,
+ (wchar_t *__restrict __s, int __n,
+ FILE *__restrict __stream), fgetws) __wur;
+
+extern __always_inline __wur wchar_t *
+fgetws (wchar_t *__restrict __s, int __n, FILE *__restrict __stream)
+{
+ if (__bos (__s) != (size_t) -1
+ && (!__builtin_constant_p (__n) || (size_t) __n > __bos (__s)))
+ return __fgetws_chk (__s, __bos (__s), __n, __stream);
+ return __fgetws_alias (__s, __n, __stream);
+}
+
+#ifdef __USE_GNU
+extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size,
+ int __n, FILE *__restrict __stream)
+ __wur;
+extern wchar_t *__REDIRECT (__fgetws_unlocked_alias,
+ (wchar_t *__restrict __s, int __n,
+ FILE *__restrict __stream), fgetws_unlocked)
+ __wur;
+
+extern __always_inline __wur wchar_t *
+fgetws_unlocked (wchar_t *__restrict __s, int __n, FILE *__restrict __stream)
+{
+ if (__bos (__s) != (size_t) -1
+ && (!__builtin_constant_p (__n) || (size_t) __n > __bos (__s)))
+ return __fgetws_unlocked_chk (__s, __bos (__s), __n, __stream);
+ return __fgetws_unlocked_alias (__s, __n, __stream);
+}
+#endif
+
+
+extern size_t __wcrtomb_chk (char *__s, wchar_t __wchar, mbstate_t *__p,
+ size_t __buflen) __THROW __wur;
+extern size_t __REDIRECT_NTH (__wcrtomb_alias,
+ (char *__restrict __s, wchar_t __wchar,
+ mbstate_t *__restrict __ps), wcrtomb) __wur;
+
+extern __always_inline __wur size_t
+wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps)
+{
+ /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
+ But this would only disturb the namespace. So we define our own
+ version here. */
+#define __WCHAR_MB_LEN_MAX 16
+#if defined MB_LEN_MAX && MB_LEN_MAX != __WCHAR_MB_LEN_MAX
+# error "Assumed value of MB_LEN_MAX wrong"
+#endif
+ if (__bos (__s) != (size_t) -1 && __WCHAR_MB_LEN_MAX > __bos (__s))
+ return __wcrtomb_chk (__s, __wchar, __ps, __bos (__s));
+ return __wcrtomb_alias (__s, __wchar, __ps);
+}
+
+
+extern size_t __mbsrtowcs_chk (wchar_t *__restrict __dst,
+ __const char **__restrict __src,
+ size_t __len, mbstate_t *__restrict __ps,
+ size_t __dstlen) __THROW;
+extern size_t __REDIRECT_NTH (__mbsrtowcs_alias,
+ (wchar_t *__restrict __dst,
+ __const char **__restrict __src,
+ size_t __len, mbstate_t *__restrict __ps),
+ mbsrtowcs);
+
+extern __always_inline size_t
+mbsrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src,
+ size_t __len, mbstate_t *__restrict __ps)
+{
+ if (__bos (__dst) != (size_t) -1
+ && (!__builtin_constant_p (__len)
+ || __len * sizeof (wchar_t) > __bos (__dst)))
+ return __mbsrtowcs_chk (__dst, __src, __len, __ps, __bos (__dst));
+ return __mbsrtowcs_alias (__dst, __src, __len, __ps);
+}
+
+
+extern size_t __wcsrtombs_chk (char *__restrict __dst,
+ __const wchar_t **__restrict __src,
+ size_t __len, mbstate_t *__restrict __ps,
+ size_t __dstlen) __THROW;
+extern size_t __REDIRECT_NTH (__wcsrtombs_alias,
+ (char *__restrict __dst,
+ __const wchar_t **__restrict __src,
+ size_t __len, mbstate_t *__restrict __ps),
+ wcsrtombs);
+
+extern __always_inline size_t
+wcsrtombs (char *__restrict __dst, __const wchar_t **__restrict __src,
+ size_t __len, mbstate_t *__restrict __ps)
+{
+ if (__bos (__dst) != (size_t) -1
+ && (!__builtin_constant_p (__len) || __len > __bos (__dst)))
+ return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
+ return __wcsrtombs_alias (__dst, __src, __len, __ps);
+}
+
+
+#ifdef __USE_GNU
+extern size_t __mbsnrtowcs_chk (wchar_t *__restrict __dst,
+ __const char **__restrict __src, size_t __nmc,
+ size_t __len, mbstate_t *__restrict __ps,
+ size_t __dstlen) __THROW;
+extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias,
+ (wchar_t *__restrict __dst,
+ __const char **__restrict __src, size_t __nmc,
+ size_t __len, mbstate_t *__restrict __ps),
+ mbsnrtowcs);
+
+extern __always_inline size_t
+mbsnrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src,
+ size_t __nmc, size_t __len, mbstate_t *__restrict __ps)
+{
+ if (__bos (__dst) != (size_t) -1
+ && (!__builtin_constant_p (__len)
+ || __len * sizeof (wchar_t) > __bos (__dst)))
+ return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps, __bos (__dst));
+ return __mbsnrtowcs_alias (__dst, __src, __nmc, __len, __ps);
+}
+
+
+extern size_t __wcsnrtombs_chk (char *__restrict __dst,
+ __const wchar_t **__restrict __src,
+ size_t __nwc, size_t __len,
+ mbstate_t *__restrict __ps, size_t __dstlen)
+ __THROW;
+extern size_t __REDIRECT_NTH (__wcsnrtombs_alias,
+ (char *__restrict __dst,
+ __const wchar_t **__restrict __src,
+ size_t __nwc, size_t __len,
+ mbstate_t *__restrict __ps), wcsnrtombs);
+
+extern __always_inline size_t
+wcsnrtombs (char *__restrict __dst, __const wchar_t **__restrict __src,
+ size_t __nwc, size_t __len, mbstate_t *__restrict __ps)
+{
+ if (__bos (__dst) != (size_t) -1
+ && (!__builtin_constant_p (__len) || __len > __bos (__dst)))
+ return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, __bos (__dst));
+ return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps);
+}
+#endif
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index fe4ee80..0c02dcc 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -833,6 +833,13 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
# include <wctype.h>
#endif
+
+/* Define some macros helping to catch buffer overflows. */
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+# include <bits/wchar2.h>
+#endif
+
+
__END_DECLS
#endif /* _WCHAR_H defined */
diff --git a/wcsmbs/wcsncpy.c b/wcsmbs/wcsncpy.c
index 8469d94..06a20d2 100644
--- a/wcsmbs/wcsncpy.c
+++ b/wcsmbs/wcsncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -22,7 +22,7 @@
/* Copy no more than N wide-characters of SRC to DEST. */
wchar_t *
-wcsncpy (dest, src, n)
+__wcsncpy (dest, src, n)
wchar_t *dest;
const wchar_t *src;
size_t n;
@@ -84,3 +84,4 @@ wcsncpy (dest, src, n)
return s;
}
+weak_alias (__wcsncpy, wcsncpy)