summaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
Diffstat (limited to 'posix')
-rw-r--r--posix/Makefile182
-rw-r--r--posix/Versions2
-rw-r--r--posix/_exit.c3
-rw-r--r--posix/alarm.c2
-rw-r--r--posix/annexc.c2
-rw-r--r--posix/bits/posix1_lim.h2
-rw-r--r--posix/bits/posix2_lim.h2
-rw-r--r--posix/bits/unistd.h10
-rw-r--r--posix/bsd-getpgrp.c2
-rw-r--r--posix/bug-glob2.c2
-rw-r--r--posix/bug-regex10.c2
-rw-r--r--posix/bug-regex11.c2
-rw-r--r--posix/bug-regex12.c2
-rw-r--r--posix/bug-regex13.c2
-rw-r--r--posix/bug-regex14.c2
-rw-r--r--posix/bug-regex17.c2
-rw-r--r--posix/bug-regex18.c2
-rw-r--r--posix/bug-regex19.c2
-rw-r--r--posix/bug-regex2.c2
-rw-r--r--posix/bug-regex20.c2
-rw-r--r--posix/bug-regex21.c2
-rw-r--r--posix/bug-regex22.c2
-rw-r--r--posix/bug-regex23.c2
-rw-r--r--posix/bug-regex25.c2
-rw-r--r--posix/bug-regex26.c2
-rw-r--r--posix/bug-regex27.c2
-rw-r--r--posix/bug-regex28.c2
-rw-r--r--posix/bug-regex3.c2
-rw-r--r--posix/bug-regex30.c2
-rw-r--r--posix/bug-regex31.c2
-rw-r--r--posix/bug-regex33.c2
-rw-r--r--posix/bug-regex34.c2
-rw-r--r--posix/bug-regex35.c2
-rw-r--r--posix/bug-regex36.c29
-rw-r--r--posix/bug-regex4.c2
-rw-r--r--posix/bug-regex6.c2
-rw-r--r--posix/bug-regex7.c2
-rw-r--r--posix/bug-regex8.c2
-rw-r--r--posix/bug-regex9.c2
-rw-r--r--posix/confstr.c32
-rw-r--r--posix/cpio.h2
-rw-r--r--posix/execl.c2
-rw-r--r--posix/execle.c2
-rw-r--r--posix/execlp.c2
-rw-r--r--posix/execv.c2
-rw-r--r--posix/execve.c2
-rw-r--r--posix/execvp.c2
-rw-r--r--posix/execvpe.c2
-rw-r--r--posix/fexecve.c2
-rw-r--r--posix/fnmatch.c42
-rw-r--r--posix/fnmatch.h2
-rw-r--r--posix/fnmatch_loop.c84
-rw-r--r--posix/fork.c2
-rw-r--r--posix/fpathconf.c2
-rw-r--r--posix/gai_strerror.c2
-rw-r--r--posix/get_child_max.c2
-rw-r--r--posix/getaddrinfo.c2
-rw-r--r--posix/getconf-speclist.c2
-rw-r--r--posix/getconf.c653
-rw-r--r--posix/getegid.c2
-rw-r--r--posix/geteuid.c2
-rw-r--r--posix/getgid.c2
-rw-r--r--posix/getgroups.c2
-rw-r--r--posix/getopt.c6
-rw-r--r--posix/getopt.h2
-rw-r--r--posix/getopt1.c2
-rw-r--r--posix/getopt_init.c2
-rw-r--r--posix/getopt_int.h2
-rw-r--r--posix/getpgid.c2
-rw-r--r--posix/getpgrp.c2
-rw-r--r--posix/getpid.c2
-rw-r--r--posix/getppid.c2
-rw-r--r--posix/getresgid.c2
-rw-r--r--posix/getresuid.c2
-rw-r--r--posix/getsid.c2
-rw-r--r--posix/getuid.c2
-rw-r--r--posix/glob.c46
-rw-r--r--posix/glob.h4
-rw-r--r--posix/glob64.c2
-rw-r--r--posix/globtest.c2
-rwxr-xr-xposix/globtest.sh4
-rw-r--r--posix/group_member.c2
-rw-r--r--posix/nanosleep.c9
-rw-r--r--posix/pathconf.c2
-rw-r--r--posix/pause.c2
-rw-r--r--posix/posix-conf-vars.h48
-rw-r--r--posix/posix-conf-vars.list113
-rw-r--r--posix/posix-envs.def53
-rw-r--r--posix/posix_madvise.c2
-rw-r--r--posix/pread.c2
-rw-r--r--posix/pread64.c2
-rw-r--r--posix/pwrite.c2
-rw-r--r--posix/pwrite64.c2
-rw-r--r--posix/re_comp.h2
-rw-r--r--posix/regcomp.c109
-rw-r--r--posix/regex.c2
-rw-r--r--posix/regex.h4
-rw-r--r--posix/regex_internal.c18
-rw-r--r--posix/regex_internal.h18
-rw-r--r--posix/regexbug1.c4
-rw-r--r--posix/regexec.c14
-rw-r--r--posix/runptests.c2
-rw-r--r--posix/sched.h8
-rw-r--r--posix/sched_cpualloc.c2
-rw-r--r--posix/sched_cpucount.c2
-rw-r--r--posix/sched_cpufree.c2
-rw-r--r--posix/sched_getaffinity.c2
-rw-r--r--posix/sched_getp.c2
-rw-r--r--posix/sched_gets.c2
-rw-r--r--posix/sched_primax.c2
-rw-r--r--posix/sched_primin.c2
-rw-r--r--posix/sched_rr_gi.c2
-rw-r--r--posix/sched_setaffinity.c2
-rw-r--r--posix/sched_setp.c2
-rw-r--r--posix/sched_sets.c2
-rw-r--r--posix/sched_yield.c2
-rw-r--r--posix/setgid.c2
-rw-r--r--posix/setpgid.c2
-rw-r--r--posix/setpgrp.c2
-rw-r--r--posix/setresgid.c2
-rw-r--r--posix/setresuid.c2
-rw-r--r--posix/setsid.c2
-rw-r--r--posix/setuid.c2
-rw-r--r--posix/sleep.c2
-rw-r--r--posix/spawn.c2
-rw-r--r--posix/spawn.h2
-rw-r--r--posix/spawn_faction_addclose.c2
-rw-r--r--posix/spawn_faction_adddup2.c2
-rw-r--r--posix/spawn_faction_addopen.c17
-rw-r--r--posix/spawn_faction_destroy.c24
-rw-r--r--posix/spawn_faction_init.c2
-rw-r--r--posix/spawn_int.h2
-rw-r--r--posix/spawnattr_destroy.c2
-rw-r--r--posix/spawnattr_getdefault.c2
-rw-r--r--posix/spawnattr_getflags.c2
-rw-r--r--posix/spawnattr_getpgroup.c2
-rw-r--r--posix/spawnattr_getschedparam.c2
-rw-r--r--posix/spawnattr_getschedpolicy.c2
-rw-r--r--posix/spawnattr_getsigmask.c2
-rw-r--r--posix/spawnattr_init.c2
-rw-r--r--posix/spawnattr_setdefault.c2
-rw-r--r--posix/spawnattr_setflags.c2
-rw-r--r--posix/spawnattr_setpgroup.c2
-rw-r--r--posix/spawnattr_setschedparam.c2
-rw-r--r--posix/spawnattr_setschedpolicy.c2
-rw-r--r--posix/spawnattr_setsigmask.c2
-rw-r--r--posix/spawni.c2
-rw-r--r--posix/spawnp.c2
-rw-r--r--posix/sys/times.h2
-rw-r--r--posix/sys/types.h14
-rw-r--r--posix/sys/utsname.h4
-rw-r--r--posix/sys/wait.h22
-rw-r--r--posix/sysconf.c2
-rw-r--r--posix/tar.h4
-rw-r--r--posix/times.c2
-rw-r--r--posix/tst-boost.c2
-rw-r--r--posix/tst-chmod.c2
-rw-r--r--posix/tst-dir.c2
-rw-r--r--posix/tst-exec.c2
-rw-r--r--posix/tst-fnmatch.c9
-rw-r--r--posix/tst-fnmatch.input2
-rw-r--r--posix/tst-fnmatch3.c52
-rw-r--r--posix/tst-fork.c2
-rw-r--r--posix/tst-getaddrinfo.c2
-rw-r--r--posix/tst-getaddrinfo4.c2
-rw-r--r--posix/tst-getaddrinfo5.c69
-rw-r--r--posix/tst-getconf.sh8
-rw-r--r--posix/tst-getlogin.c57
-rw-r--r--posix/tst-getopt_long1.c2
-rw-r--r--posix/tst-gnuglob.c9
-rw-r--r--posix/tst-mmap.c7
-rw-r--r--posix/tst-nanosleep.c2
-rw-r--r--posix/tst-nice.c2
-rw-r--r--posix/tst-pathconf.c2
-rw-r--r--posix/tst-pcre.c2
-rw-r--r--posix/tst-preadwrite.c2
-rw-r--r--posix/tst-preadwrite64.c2
-rw-r--r--posix/tst-regex.c18
-rw-r--r--posix/tst-regexloc.c2
-rw-r--r--posix/tst-rfc3484-2.c1
-rw-r--r--posix/tst-rfc3484-3.c1
-rw-r--r--posix/tst-rfc3484.c1
-rw-r--r--posix/tst-rxspencer-no-utf8.c1
-rw-r--r--posix/tst-rxspencer.c2
-rw-r--r--posix/tst-spawn.c12
-rw-r--r--posix/tst-truncate.c2
-rw-r--r--posix/tst-truncate64.c2
-rw-r--r--posix/tst-vfork1.c2
-rw-r--r--posix/tst-vfork2.c2
-rw-r--r--posix/tst-vfork3.c2
-rw-r--r--posix/tst-waitid.c2
-rw-r--r--posix/uname-values.h28
-rw-r--r--posix/uname.c7
-rw-r--r--posix/unistd.h73
-rw-r--r--posix/vfork.c2
-rw-r--r--posix/wait.c2
-rw-r--r--posix/wait3.c2
-rw-r--r--posix/wait4.c2
-rw-r--r--posix/waitid.c2
-rw-r--r--posix/waitpid.c9
-rw-r--r--posix/wordexp-test.c126
-rwxr-xr-xposix/wordexp-tst.sh36
-rw-r--r--posix/wordexp.c36
-rw-r--r--posix/wordexp.h2
204 files changed, 1161 insertions, 1287 deletions
diff --git a/posix/Makefile b/posix/Makefile
index 6709900cb2..15e8818787 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2014 Free Software Foundation, Inc.
+# Copyright (C) 1991-2015 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
@@ -20,6 +20,8 @@
#
subdir := posix
+include ../Makeconfig
+
headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
glob.h regex.h wordexp.h fnmatch.h getopt.h \
bits/types.h bits/typesizes.h bits/pthreadtypes.h \
@@ -59,12 +61,10 @@ routines := \
posix_madvise \
get_child_max sched_cpucount sched_cpualloc sched_cpufree
-include ../Makeconfig
-
aux := init-posix environ
tests := tstgetopt testfnm runtests runptests \
tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
- tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
+ tst-mmap tst-getaddrinfo tst-truncate \
tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
@@ -86,7 +86,8 @@ tests := tstgetopt testfnm runtests runptests \
tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
- tst-pathconf tst-getaddrinfo4
+ tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 \
+ tst-fnmatch3 bug-regex36 tst-getaddrinfo5
xtests := bug-ga2
ifeq (yes,$(build-shared))
test-srcs := globtest
@@ -98,31 +99,54 @@ others := getconf
install-bin := getconf
install-others-programs := $(inst_libexecdir)/getconf
-before-compile := testcases.h ptestcases.h
+before-compile += testcases.h ptestcases.h $(objpfx)posix-conf-vars-def.h
# So they get cleaned up.
-generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
- annexc annexc.out wordexp-tst.out bug-regex2-mem \
- bug-regex2.mtrace bug-regex14-mem bug-regex14.mtrace \
- bug-regex21-mem bug-regex21.mtrace \
- bug-regex31-mem bug-regex31.mtrace \
- tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
- tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
- bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
- tst-vfork3-mem tst-vfork3.mtrace getconf.speclist \
- tst-fnmatch-mem tst-fnmatch.mtrace
+generated += $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
+ annexc annexc.out wordexp-tst.out bug-regex2-mem.out \
+ bug-regex2.mtrace bug-regex14-mem.out bug-regex14.mtrace \
+ bug-regex21-mem.out bug-regex21.mtrace \
+ bug-regex31-mem.out bug-regex31.mtrace \
+ tst-rxspencer-no-utf8-mem.out tst-rxspencer-no-utf8.mtrace \
+ tst-getconf.out \
+ tst-pcre-mem.out tst-pcre.mtrace tst-boost-mem.out \
+ tst-boost.mtrace bug-ga2.mtrace bug-ga2-mem.out \
+ bug-glob2.mtrace bug-glob2-mem.out tst-vfork3-mem.out \
+ tst-vfork3.mtrace getconf.speclist tst-fnmatch-mem.out \
+ tst-fnmatch.mtrace bug-regex36.mtrace
+
+ifeq ($(run-built-tests),yes)
+ifeq (yes,$(build-shared))
+tests-special += $(objpfx)globtest.out $(objpfx)wordexp-tst.out
+endif
+endif
+
+# Run a test on the header files we use.
+# XXX Please note that for now we ignore the result of this test.
+tests-special += $(objpfx)annexc.out
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \
+ $(objpfx)bug-regex21-mem.out $(objpfx)bug-regex31-mem.out \
+ $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \
+ $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \
+ $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \
+ $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out
+xtests-special += $(objpfx)bug-ga2-mem.out
+endif
include ../Rules
ifeq ($(run-built-tests),yes)
# globtest and wordexp-test currently only works with shared libraries
ifeq (yes,$(build-shared))
-tests: $(objpfx)globtest.out $(objpfx)wordexp-tst.out
$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
$(SHELL) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
- '$(test-program-prefix)' '$(test-wrapper-env)'
+ '$(test-program-prefix)' '$(test-wrapper-env)'; \
+ $(evaluate-test)
$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
- $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+ '$(run-program-env)' '$(test-program-prefix-after-env)'; \
+ $(evaluate-test)
endif
endif
@@ -181,28 +205,8 @@ tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir);
tst-chmod-ARGS = $(objdir)
tst-vfork3-ARGS = --test-dir=$(objpfx)
-tst-fnmatch-ENV = LOCPATH=$(common-objpfx)localedata
-tst-regexloc-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex1-ENV = LOCPATH=$(common-objpfx)localedata
-tst-regex-ENV = LOCPATH=$(common-objpfx)localedata
-tst-regex2-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex5-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex6-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex17-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex18-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex19-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex20-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex22-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex23-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex25-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex26-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex30-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex32-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex33-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex34-ENV = LOCPATH=$(common-objpfx)localedata
-bug-regex35-ENV = LOCPATH=$(common-objpfx)localedata
tst-rxspencer-ARGS = --utf8 rxspencer/tests
-tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
+tst-rxspencer-no-utf8-ARGS = rxspencer/tests
tst-pcre-ARGS = PCRE.tests
tst-boost-ARGS = BOOST.tests
bug-glob1-ARGS = "$(objpfx)"
@@ -216,20 +220,11 @@ ptestcases.h: PTESTS PTESTS2C.sed
LC_ALL=C sed -f PTESTS2C.sed < $< > $@T
mv -f $@T $@
-# Run a test on the header files we use.
-# XXX Please note that for now we ignore the result of this test.
-tests: $(objpfx)annexc.out
-ifeq ($(run-built-tests),yes)
-tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
- $(objpfx)bug-regex21-mem $(objpfx)bug-regex31-mem $(objpfx)tst-rxspencer-mem\
- $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
- $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem $(objpfx)tst-fnmatch-mem
-xtests: $(objpfx)bug-ga2-mem
-endif
-
+test-xfail-annexc = yes
$(objpfx)annexc.out: $(objpfx)annexc
- -$(dir $<)$(notdir $<) '$(CC)' \
- '$(patsubst %,-I../%,$(sorted-subdirs)) -I../include $(+sysdep-includes) $(sysincludes) -I..' > $@
+ $(dir $<)$(notdir $<) '$(CC)' \
+ '$(patsubst %,-I../%,$(sorted-subdirs)) -I../include $(+sysdep-includes) $(sysincludes) -I..' > $@; \
+ $(evaluate-test)
annexc-CFLAGS = -O
$(objpfx)annexc: annexc.c
@@ -237,63 +232,80 @@ $(objpfx)annexc: annexc.c
tst-fnmatch-ENV += MALLOC_TRACE=$(objpfx)tst-fnmatch.mtrace
-$(objpfx)tst-fnmatch-mem: $(objpfx)tst-fnmatch.out
- $(common-objpfx)malloc/mtrace $(objpfx)tst-fnmatch.mtrace > $@
+$(objpfx)tst-fnmatch-mem.out: $(objpfx)tst-fnmatch.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-fnmatch.mtrace > $@; \
+ $(evaluate-test)
bug-regex2-ENV = MALLOC_TRACE=$(objpfx)bug-regex2.mtrace
-$(objpfx)bug-regex2-mem: $(objpfx)bug-regex2.out
- $(common-objpfx)malloc/mtrace $(objpfx)bug-regex2.mtrace > $@
+$(objpfx)bug-regex2-mem.out: $(objpfx)bug-regex2.out
+ $(common-objpfx)malloc/mtrace $(objpfx)bug-regex2.mtrace > $@; \
+ $(evaluate-test)
bug-regex14-ENV = MALLOC_TRACE=$(objpfx)bug-regex14.mtrace
-$(objpfx)bug-regex14-mem: $(objpfx)bug-regex14.out
- $(common-objpfx)malloc/mtrace $(objpfx)bug-regex14.mtrace > $@
+$(objpfx)bug-regex14-mem.out: $(objpfx)bug-regex14.out
+ $(common-objpfx)malloc/mtrace $(objpfx)bug-regex14.mtrace > $@; \
+ $(evaluate-test)
bug-regex21-ENV = MALLOC_TRACE=$(objpfx)bug-regex21.mtrace
-$(objpfx)bug-regex21-mem: $(objpfx)bug-regex21.out
- $(common-objpfx)malloc/mtrace $(objpfx)bug-regex21.mtrace > $@
+$(objpfx)bug-regex21-mem.out: $(objpfx)bug-regex21.out
+ $(common-objpfx)malloc/mtrace $(objpfx)bug-regex21.mtrace > $@; \
+ $(evaluate-test)
bug-regex31-ENV = MALLOC_TRACE=$(objpfx)bug-regex31.mtrace
-$(objpfx)bug-regex31-mem: $(objpfx)bug-regex31.out
- $(common-objpfx)malloc/mtrace $(objpfx)bug-regex31.mtrace > $@
+$(objpfx)bug-regex31-mem.out: $(objpfx)bug-regex31.out
+ $(common-objpfx)malloc/mtrace $(objpfx)bug-regex31.mtrace > $@; \
+ $(evaluate-test)
+
+bug-regex36-ENV = MALLOC_TRACE=$(objpfx)bug-regex36.mtrace
+
+$(objpfx)bug-regex36-mem.out: $(objpfx)bug-regex36.out
+ $(common-objpfx)malloc/mtrace $(objpfx)bug-regex36.mtrace > $@; \
+ $(evaluate-test)
tst-vfork3-ENV = MALLOC_TRACE=$(objpfx)tst-vfork3.mtrace
-$(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
- $(common-objpfx)malloc/mtrace $(objpfx)tst-vfork3.mtrace > $@
+$(objpfx)tst-vfork3-mem.out: $(objpfx)tst-vfork3.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-vfork3.mtrace > $@; \
+ $(evaluate-test)
-# tst-rxspencer.mtrace is generated only when run without --utf8
-# option, since otherwise the file has almost 100M and takes very long
-# time to process.
-$(objpfx)tst-rxspencer-mem: $(objpfx)tst-rxspencer.out
- MALLOC_TRACE=$(objpfx)tst-rxspencer.mtrace $(tst-rxspencer-ENV) \
- $(test-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \
- > /dev/null
- $(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer.mtrace > $@
+# tst-rxspencer.mtrace is not generated, only
+# tst-rxspencer-no-utf8.mtrace, since otherwise the file has almost
+# 100M and takes very long time to process.
+tst-rxspencer-no-utf8-ENV += MALLOC_TRACE=$(objpfx)tst-rxspencer-no-utf8.mtrace
+$(objpfx)tst-rxspencer-no-utf8-mem.out: $(objpfx)tst-rxspencer-no-utf8.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer-no-utf8.mtrace \
+ > $@; \
+ $(evaluate-test)
tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace
-$(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out
- $(common-objpfx)malloc/mtrace $(objpfx)tst-pcre.mtrace > $@
+$(objpfx)tst-pcre-mem.out: $(objpfx)tst-pcre.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-pcre.mtrace > $@; \
+ $(evaluate-test)
tst-boost-ENV = MALLOC_TRACE=$(objpfx)tst-boost.mtrace
-$(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
- $(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@
+$(objpfx)tst-boost-mem.out: $(objpfx)tst-boost.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@; \
+ $(evaluate-test)
$(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
- $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd)'; \
+ $(evaluate-test)
-$(objpfx)bug-ga2-mem: $(objpfx)bug-ga2.out
- $(common-objpfx)malloc/mtrace $(objpfx)bug-ga2.mtrace > $@
+$(objpfx)bug-ga2-mem.out: $(objpfx)bug-ga2.out
+ $(common-objpfx)malloc/mtrace $(objpfx)bug-ga2.mtrace > $@; \
+ $(evaluate-test)
bug-ga2-ENV = MALLOC_TRACE=$(objpfx)bug-ga2.mtrace
bug-glob2-ENV = MALLOC_TRACE=$(objpfx)bug-glob2.mtrace
-$(objpfx)bug-glob2-mem: $(objpfx)bug-glob2.out
- $(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@
+$(objpfx)bug-glob2-mem.out: $(objpfx)bug-glob2.out
+ $(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@; \
+ $(evaluate-test)
$(inst_libexecdir)/getconf: $(inst_bindir)/getconf \
$(objpfx)getconf.speclist FORCE
@@ -313,3 +325,9 @@ $(objpfx)getconf.speclist: getconf-speclist.c posix-envs.def
# be built both makes it available for eyeball inspection and avoids the
# surprise of things that look like compilation being done by 'make install'.
others: $(objpfx)getconf.speclist
+
+$(objpfx)posix-conf-vars-def.h: $(..)scripts/gen-posix-conf-vars.awk \
+ posix-conf-vars.list Makefile
+ $(make-target-directory)
+ $(AWK) -f $(filter-out Makefile, $^) > $@.tmp
+ mv -f $@.tmp $@
diff --git a/posix/Versions b/posix/Versions
index 68df3a9f39..bb481a505b 100644
--- a/posix/Versions
+++ b/posix/Versions
@@ -135,6 +135,6 @@ libc {
execvpe;
}
GLIBC_PRIVATE {
- __libc_fork; __libc_pwrite;
+ __libc_fork; __libc_pread; __libc_pwrite;
}
}
diff --git a/posix/_exit.c b/posix/_exit.c
index aa8c928908..f4d76a10d0 100644
--- a/posix/_exit.c
+++ b/posix/_exit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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,6 +29,7 @@ _exit (status)
abort ();
}
libc_hidden_def (_exit)
+rtld_hidden_def (_exit)
weak_alias (_exit, _Exit)
stub_warning (_exit)
diff --git a/posix/alarm.c b/posix/alarm.c
index 6dbbf0395b..1ecfc4fbb8 100644
--- a/posix/alarm.c
+++ b/posix/alarm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/annexc.c b/posix/annexc.c
index b31f760647..f05273b96f 100644
--- a/posix/annexc.c
+++ b/posix/annexc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 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
diff --git a/posix/bits/posix1_lim.h b/posix/bits/posix1_lim.h
index 97f018d0a4..400bc969a5 100644
--- a/posix/bits/posix1_lim.h
+++ b/posix/bits/posix1_lim.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/bits/posix2_lim.h b/posix/bits/posix2_lim.h
index 0dbdf1e6d6..15754b8178 100644
--- a/posix/bits/posix2_lim.h
+++ b/posix/bits/posix2_lim.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
index 336b928b40..a88faed914 100644
--- a/posix/bits/unistd.h
+++ b/posix/bits/unistd.h
@@ -1,5 +1,5 @@
/* Checking macros for unistd functions.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 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
@@ -119,7 +119,7 @@ pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
# endif
#endif
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
extern ssize_t __readlink_chk (const char *__restrict __path,
char *__restrict __buf, size_t __len,
size_t __buflen)
@@ -210,7 +210,7 @@ __NTH (getcwd (char *__buf, size_t __size))
return __getcwd_alias (__buf, __size);
}
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
extern char *__getwd_chk (char *__buf, size_t buflen)
__THROW __nonnull ((1)) __wur;
extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd)
@@ -329,7 +329,7 @@ getlogin_r (char *__buf, size_t __buflen)
#endif
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_MISC || 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),
@@ -356,7 +356,7 @@ __NTH (gethostname (char *__buf, size_t __buflen))
#endif
-#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
+#if defined __USE_MISC || (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,
diff --git a/posix/bsd-getpgrp.c b/posix/bsd-getpgrp.c
index f06a5d78be..d467ee53c8 100644
--- a/posix/bsd-getpgrp.c
+++ b/posix/bsd-getpgrp.c
@@ -1,5 +1,5 @@
/* BSD-compatible versions of getpgrp function.
- Copyright (C) 1991-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991-2015 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
diff --git a/posix/bug-glob2.c b/posix/bug-glob2.c
index 8e21deb658..1f302fec7b 100644
--- a/posix/bug-glob2.c
+++ b/posix/bug-glob2.c
@@ -1,6 +1,6 @@
/* Test glob memory management.
for the filesystem access functions.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 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
diff --git a/posix/bug-regex10.c b/posix/bug-regex10.c
index d9d97525e8..26e6fecd4b 100644
--- a/posix/bug-regex10.c
+++ b/posix/bug-regex10.c
@@ -1,5 +1,5 @@
/* Test for re_match with non-zero start.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
diff --git a/posix/bug-regex11.c b/posix/bug-regex11.c
index 2669f0ca70..dd0f97c302 100644
--- a/posix/bug-regex11.c
+++ b/posix/bug-regex11.c
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
diff --git a/posix/bug-regex12.c b/posix/bug-regex12.c
index b576d2558b..b3a6730c6f 100644
--- a/posix/bug-regex12.c
+++ b/posix/bug-regex12.c
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
diff --git a/posix/bug-regex13.c b/posix/bug-regex13.c
index d344faa4d3..62730ccd88 100644
--- a/posix/bug-regex13.c
+++ b/posix/bug-regex13.c
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>, 2002.
diff --git a/posix/bug-regex14.c b/posix/bug-regex14.c
index 1028cfd89e..12fc4541b0 100644
--- a/posix/bug-regex14.c
+++ b/posix/bug-regex14.c
@@ -1,5 +1,5 @@
/* Tests re_comp and re_exec.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>, 2002.
diff --git a/posix/bug-regex17.c b/posix/bug-regex17.c
index 73466a74dc..3dd2ba037c 100644
--- a/posix/bug-regex17.c
+++ b/posix/bug-regex17.c
@@ -1,5 +1,5 @@
/* German regular expression tests.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
diff --git a/posix/bug-regex18.c b/posix/bug-regex18.c
index fac7ff2873..0e2859dd1a 100644
--- a/posix/bug-regex18.c
+++ b/posix/bug-regex18.c
@@ -1,5 +1,5 @@
/* Turkish regular expression tests.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
diff --git a/posix/bug-regex19.c b/posix/bug-regex19.c
index cd4ef59aba..41312d54f2 100644
--- a/posix/bug-regex19.c
+++ b/posix/bug-regex19.c
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/posix/bug-regex2.c b/posix/bug-regex2.c
index 0597ea043a..1c64615781 100644
--- a/posix/bug-regex2.c
+++ b/posix/bug-regex2.c
@@ -1,5 +1,5 @@
/* Test for memory handling in regex.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/posix/bug-regex20.c b/posix/bug-regex20.c
index c0377e90f8..2ecc54894c 100644
--- a/posix/bug-regex20.c
+++ b/posix/bug-regex20.c
@@ -1,5 +1,5 @@
/* Test for UTF-8 regular expression optimizations.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/posix/bug-regex21.c b/posix/bug-regex21.c
index 7566691f79..be76225e09 100644
--- a/posix/bug-regex21.c
+++ b/posix/bug-regex21.c
@@ -1,5 +1,5 @@
/* Test for memory leaks in regcomp.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/posix/bug-regex22.c b/posix/bug-regex22.c
index b5d0146731..673bae10ba 100644
--- a/posix/bug-regex22.c
+++ b/posix/bug-regex22.c
@@ -1,5 +1,5 @@
/* Test re.translate != NULL.
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
diff --git a/posix/bug-regex23.c b/posix/bug-regex23.c
index b0718915fd..f36f3da99e 100644
--- a/posix/bug-regex23.c
+++ b/posix/bug-regex23.c
@@ -1,5 +1,5 @@
/* Test we don't segfault on invalid UTF-8 sequence.
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
diff --git a/posix/bug-regex25.c b/posix/bug-regex25.c
index 2ae0564ca3..c17722e4ef 100644
--- a/posix/bug-regex25.c
+++ b/posix/bug-regex25.c
@@ -1,5 +1,5 @@
/* Test re_search in multibyte locale other than UTF-8.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
diff --git a/posix/bug-regex26.c b/posix/bug-regex26.c
index 76f0e6e51e..d950d5193c 100644
--- a/posix/bug-regex26.c
+++ b/posix/bug-regex26.c
@@ -1,5 +1,5 @@
/* Test re_search with dotless i.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
diff --git a/posix/bug-regex27.c b/posix/bug-regex27.c
index a18e395f05..a44c4de0f9 100644
--- a/posix/bug-regex27.c
+++ b/posix/bug-regex27.c
@@ -1,5 +1,5 @@
/* Test REG_NEWLINE.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
diff --git a/posix/bug-regex28.c b/posix/bug-regex28.c
index 941527a1ba..93da1f5bba 100644
--- a/posix/bug-regex28.c
+++ b/posix/bug-regex28.c
@@ -1,5 +1,5 @@
/* Test RE_HAT_LISTS_NOT_NEWLINE and RE_DOT_NEWLINE.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
diff --git a/posix/bug-regex3.c b/posix/bug-regex3.c
index bbc08f5e5b..d59464450c 100644
--- a/posix/bug-regex3.c
+++ b/posix/bug-regex3.c
@@ -1,5 +1,5 @@
/* Test for case handling in regex.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
diff --git a/posix/bug-regex30.c b/posix/bug-regex30.c
index febba7d445..bc76ad5fcb 100644
--- a/posix/bug-regex30.c
+++ b/posix/bug-regex30.c
@@ -1,5 +1,5 @@
/* Russian regular expression tests.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paolo Bonzini <pbonzini@redhat.com>, 2009.
diff --git a/posix/bug-regex31.c b/posix/bug-regex31.c
index fc485815fc..fd7e0c57ca 100644
--- a/posix/bug-regex31.c
+++ b/posix/bug-regex31.c
@@ -33,5 +33,5 @@ main (void)
free (buf);
- return 0;
+ return res;
}
diff --git a/posix/bug-regex33.c b/posix/bug-regex33.c
index 626a681274..ad2a8af13c 100644
--- a/posix/bug-regex33.c
+++ b/posix/bug-regex33.c
@@ -1,5 +1,5 @@
/* Test re_search with multi-byte characters in EUC-JP.
- Copyright (C) 2012-2014 Free Software Foundation, Inc.
+ Copyright (C) 2012-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Stanislav Brabec <sbrabec@suse.cz>, 2012.
diff --git a/posix/bug-regex34.c b/posix/bug-regex34.c
index cf369ac736..a7eca3875b 100644
--- a/posix/bug-regex34.c
+++ b/posix/bug-regex34.c
@@ -1,5 +1,5 @@
/* Test re_search with multi-byte characters in UTF-8.
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 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
diff --git a/posix/bug-regex35.c b/posix/bug-regex35.c
index 57023b29cc..e0b61d424d 100644
--- a/posix/bug-regex35.c
+++ b/posix/bug-regex35.c
@@ -1,5 +1,5 @@
/* Test regcomp with collating symbols in bracket expressions
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 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
diff --git a/posix/bug-regex36.c b/posix/bug-regex36.c
new file mode 100644
index 0000000000..ffe506a880
--- /dev/null
+++ b/posix/bug-regex36.c
@@ -0,0 +1,29 @@
+/* Test regcomp not leaking memory on parse errors
+ Copyright (C) 2014-2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <mcheck.h>
+#include <regex.h>
+
+int
+main (int argc, char **argv)
+{
+ regex_t r;
+ mtrace ();
+ regcomp (&r, "[a]\\|[a]\\{-2,}", 0);
+ regfree (&r);
+}
diff --git a/posix/bug-regex4.c b/posix/bug-regex4.c
index d7c417e434..ec95acd4cb 100644
--- a/posix/bug-regex4.c
+++ b/posix/bug-regex4.c
@@ -1,5 +1,5 @@
/* Test for re_search_2.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
diff --git a/posix/bug-regex6.c b/posix/bug-regex6.c
index c66f8253fd..efcc890a9f 100644
--- a/posix/bug-regex6.c
+++ b/posix/bug-regex6.c
@@ -1,5 +1,5 @@
/* Test for regexec.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
diff --git a/posix/bug-regex7.c b/posix/bug-regex7.c
index 57e3e12d83..496a7ec426 100644
--- a/posix/bug-regex7.c
+++ b/posix/bug-regex7.c
@@ -1,5 +1,5 @@
/* Test for regs allocation in re_search and re_match.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Stepan Kasal <kasal@math.cas.cz>, 2002.
diff --git a/posix/bug-regex8.c b/posix/bug-regex8.c
index 6a33d7e64a..c6e04e66d6 100644
--- a/posix/bug-regex8.c
+++ b/posix/bug-regex8.c
@@ -1,5 +1,5 @@
/* Test for the STOP parameter of re_match_2 and re_search_2.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Stepan Kasal <kasal@math.cas.cz>, 2002.
diff --git a/posix/bug-regex9.c b/posix/bug-regex9.c
index 2567ab6189..b235e3058b 100644
--- a/posix/bug-regex9.c
+++ b/posix/bug-regex9.c
@@ -1,5 +1,5 @@
/* Test for memory handling in regex.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
diff --git a/posix/confstr.c b/posix/confstr.c
index a2a1bf2862..7271c5c55f 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,9 @@
#include <confstr.h>
#include "../version.h"
+#define NEED_SPEC_ARRAY 0
+#include <posix-conf-vars.h>
+
/* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes
of BUF with the value corresponding to NAME and zero-terminate BUF.
Return the number of bytes required to hold NAME's entire value. */
@@ -100,9 +103,9 @@ confstr (name, buf, len)
case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
case _CS_POSIX_V7_ILP32_OFF32_CFLAGS:
#ifdef __ILP32_OFF32_CFLAGS
-# if _POSIX_V7_ILP32_OFF32 == -1
+# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFF32)
# error "__ILP32_OFF32_CFLAGS should not be defined"
-# elif !defined _POSIX_V7_ILP32_OFF32
+# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFF32)
if (__sysconf (_SC_V7_ILP32_OFF32) < 0)
break;
# endif
@@ -115,9 +118,9 @@ confstr (name, buf, len)
case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS:
case _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS:
#ifdef __ILP32_OFFBIG_CFLAGS
-# if _POSIX_V7_ILP32_OFFBIG == -1
+# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFFBIG)
# error "__ILP32_OFFBIG_CFLAGS should not be defined"
-# elif !defined _POSIX_V7_ILP32_OFFBIG
+# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFFBIG)
if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0)
break;
# endif
@@ -130,9 +133,9 @@ confstr (name, buf, len)
case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
case _CS_POSIX_V7_LP64_OFF64_CFLAGS:
#ifdef __LP64_OFF64_CFLAGS
-# if _POSIX_V7_LP64_OFF64 == -1
+# if CONF_IS_DEFINED_UNSET (_POSIX_V7_LP64_OFF64)
# error "__LP64_OFF64_CFLAGS should not be defined"
-# elif !defined _POSIX_V7_LP64_OFF64
+# elif CONF_IS_UNDEFINED (_POSIX_V7_LP64_OFF64)
if (__sysconf (_SC_V7_LP64_OFF64) < 0)
break;
# endif
@@ -145,9 +148,9 @@ confstr (name, buf, len)
case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
case _CS_POSIX_V7_ILP32_OFF32_LDFLAGS:
#ifdef __ILP32_OFF32_LDFLAGS
-# if _POSIX_V7_ILP32_OFF32 == -1
+# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFF32 )
# error "__ILP32_OFF32_LDFLAGS should not be defined"
-# elif !defined _POSIX_V7_ILP32_OFF32
+# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFF32)
if (__sysconf (_SC_V7_ILP32_OFF32) < 0)
break;
# endif
@@ -160,9 +163,9 @@ confstr (name, buf, len)
case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
case _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS:
#ifdef __ILP32_OFFBIG_LDFLAGS
-# if _POSIX_V7_ILP32_OFFBIG == -1
+# if CONF_IS_DEFINED_UNSET (_POSIX_V7_ILP32_OFFBIG)
# error "__ILP32_OFFBIG_LDFLAGS should not be defined"
-# elif !defined _POSIX_V7_ILP32_OFFBIG
+# elif CONF_IS_UNDEFINED (_POSIX_V7_ILP32_OFFBIG)
if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0)
break;
# endif
@@ -175,9 +178,9 @@ confstr (name, buf, len)
case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
case _CS_POSIX_V7_LP64_OFF64_LDFLAGS:
#ifdef __LP64_OFF64_LDFLAGS
-# if _POSIX_V7_LP64_OFF64 == -1
+# if CONF_IS_DEFINED_UNSET (_POSIX_V7_LP64_OFF64)
# error "__LP64_OFF64_LDFLAGS should not be defined"
-# elif !defined _POSIX_V7_LP64_OFF64
+# elif CONF_IS_UNDEFINED (_POSIX_V7_LP64_OFF64)
if (__sysconf (_SC_V7_LP64_OFF64) < 0)
break;
# endif
@@ -188,7 +191,8 @@ confstr (name, buf, len)
case _CS_LFS_CFLAGS:
case _CS_LFS_LINTFLAGS:
-#if _POSIX_V6_ILP32_OFF32 == 1 && _POSIX_V6_ILP32_OFFBIG == 1
+#if (CONF_IS_DEFINED_SET (_POSIX_V6_ILP32_OFF32) \
+ && CONF_IS_DEFINED_SET (_POSIX_V6_ILP32_OFFBIG))
# define __LFS_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
/* Signal that we want the new ABI. */
string = __LFS_CFLAGS;
diff --git a/posix/cpio.h b/posix/cpio.h
index db15a79a90..3568d2ffe3 100644
--- a/posix/cpio.h
+++ b/posix/cpio.h
@@ -1,6 +1,6 @@
/* Extended cpio format from POSIX.1.
This file is part of the GNU C Library.
- Copyright (C) 1992-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992-2015 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU cpio.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/posix/execl.c b/posix/execl.c
index cdd0fa3c36..7d89192675 100644
--- a/posix/execl.c
+++ b/posix/execl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/execle.c b/posix/execle.c
index eac270edae..dff95b2c1f 100644
--- a/posix/execle.c
+++ b/posix/execle.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/execlp.c b/posix/execlp.c
index b0de543dd4..5e45de967a 100644
--- a/posix/execlp.c
+++ b/posix/execlp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/execv.c b/posix/execv.c
index 4bda05f897..ee56f79ab5 100644
--- a/posix/execv.c
+++ b/posix/execv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/execve.c b/posix/execve.c
index 3aaa477bf5..4f8adcf271 100644
--- a/posix/execve.c
+++ b/posix/execve.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/execvp.c b/posix/execvp.c
index 88e263f0ba..fa0313911b 100644
--- a/posix/execvp.c
+++ b/posix/execvp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/execvpe.c b/posix/execvpe.c
index e067ada17b..5170e043d7 100644
--- a/posix/execvpe.c
+++ b/posix/execvpe.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/fexecve.c b/posix/fexecve.c
index 6be655004e..95c8385bcd 100644
--- a/posix/fexecve.c
+++ b/posix/fexecve.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2015 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
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index f748d3df46..fd85efa2c7 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,12 +28,7 @@
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
-
-#if HAVE_STRING_H || defined _LIBC
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
@@ -225,13 +220,16 @@ __wcschrnul (s, c)
# define MEMPCPY(D, S, N) __mempcpy (D, S, N)
# define MEMCHR(S, C, N) memchr (S, C, N)
# define STRCOLL(S1, S2) strcoll (S1, S2)
+# define WIDE_CHAR_VERSION 0
+# include <locale/weight.h>
+# define FINDIDX findidx
# include "fnmatch_loop.c"
# if HANDLE_MULTIBYTE
/* Note that this evaluates C many times. */
# ifdef _LIBC
-# define FOLD(c) ((flags & FNM_CASEFOLD) ? towlower (c) : (c))
+# define FOLD(c) ((flags & FNM_CASEFOLD) ? __towlower (c) : (c))
# else
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? towlower (c) : (c))
# endif
@@ -247,9 +245,15 @@ __wcschrnul (s, c)
# define STRLEN(S) __wcslen (S)
# define STRCAT(D, S) __wcscat (D, S)
# define MEMPCPY(D, S, N) __wmempcpy (D, S, N)
-# define MEMCHR(S, C, N) wmemchr (S, C, N)
+# define MEMCHR(S, C, N) __wmemchr (S, C, N)
# define STRCOLL(S1, S2) wcscoll (S1, S2)
# define WIDE_CHAR_VERSION 1
+/* Change the name the header defines so it doesn't conflict with
+ the <locale/weight.h> version included above. */
+# define findidx findidxwc
+# include <locale/weightwc.h>
+# undef findidx
+# define FINDIDX findidxwc
# undef IS_CHAR_CLASS
/* We have to convert the wide character string in a multibyte string. But
@@ -344,16 +348,16 @@ fnmatch (pattern, string, flags)
memset (&ps, '\0', sizeof (ps));
p = pattern;
#ifdef _LIBC
- n = strnlen (pattern, 1024);
+ n = __strnlen (pattern, 1024);
#else
n = strlen (pattern);
#endif
- if (__builtin_expect (n < 1024, 1))
+ if (__glibc_likely (n < 1024))
{
wpattern = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
alloca_used);
n = mbsrtowcs (wpattern, &p, n + 1, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
@@ -368,12 +372,12 @@ fnmatch (pattern, string, flags)
{
prepare_wpattern:
n = mbsrtowcs (NULL, &pattern, 0, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
return -1;
- if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+ if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
{
__set_errno (ENOMEM);
return -2;
@@ -388,17 +392,17 @@ fnmatch (pattern, string, flags)
assert (mbsinit (&ps));
#ifdef _LIBC
- n = strnlen (string, 1024);
+ n = __strnlen (string, 1024);
#else
n = strlen (string);
#endif
p = string;
- if (__builtin_expect (n < 1024, 1))
+ if (__glibc_likely (n < 1024))
{
wstring = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
alloca_used);
n = mbsrtowcs (wstring, &p, n + 1, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
{
/* Something wrong.
XXX Do we have to set `errno' to something which
@@ -417,12 +421,12 @@ fnmatch (pattern, string, flags)
{
prepare_wstring:
n = mbsrtowcs (NULL, &string, 0, &ps);
- if (__builtin_expect (n == (size_t) -1, 0))
+ if (__glibc_unlikely (n == (size_t) -1))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
goto free_return;
- if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
+ if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
{
free (wpattern_malloc);
__set_errno (ENOMEM);
diff --git a/posix/fnmatch.h b/posix/fnmatch.h
index ac96fb8780..28bde33dbf 100644
--- a/posix/fnmatch.h
+++ b/posix/fnmatch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c
index f79d051a3a..f46c9dfedb 100644
--- a/posix/fnmatch_loop.c
+++ b/posix/fnmatch_loop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -343,7 +343,12 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
#ifdef _LIBC
else if (c == L('[') && *p == L('='))
{
- UCHAR str[1];
+ /* It's important that STR be a scalar variable rather
+ than a one-element array, because GCC (at least 4.9.2
+ -O2 on x86-64) can be confused by the array and
+ diagnose a "used initialized" in a dead branch in the
+ findidx function. */
+ UCHAR str;
uint32_t nrules =
_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
const CHAR *startp = p;
@@ -355,7 +360,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
c = L('[');
goto normal_bracket;
}
- str[0] = c;
+ str = c;
c = *++p;
if (c != L('=') || p[1] != L(']'))
@@ -368,7 +373,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
if (nrules == 0)
{
- if ((UCHAR) *n == str[0])
+ if ((UCHAR) *n == str)
goto matched;
}
else
@@ -376,28 +381,21 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
const int32_t *table;
# if WIDE_CHAR_VERSION
const int32_t *weights;
- const int32_t *extra;
+ const wint_t *extra;
# else
const unsigned char *weights;
const unsigned char *extra;
# endif
const int32_t *indirect;
int32_t idx;
- const UCHAR *cp = (const UCHAR *) str;
-
- /* This #include defines a local function! */
-# if WIDE_CHAR_VERSION
-# include <locale/weightwc.h>
-# else
-# include <locale/weight.h>
-# endif
+ const UCHAR *cp = (const UCHAR *) &str;
# if WIDE_CHAR_VERSION
table = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
weights = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
- extra = (const int32_t *)
+ extra = (const wint_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
indirect = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
@@ -412,7 +410,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
# endif
- idx = findidx (&cp, 1);
+ idx = FINDIDX (table, indirect, extra, &cp, 1);
if (idx != 0)
{
/* We found a table entry. Now see whether the
@@ -422,7 +420,8 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
int32_t idx2;
const UCHAR *np = (const UCHAR *) n;
- idx2 = findidx (&np, string_end - n);
+ idx2 = FINDIDX (table, indirect, extra,
+ &np, string_end - n);
if (idx2 != 0
&& (idx >> 24) == (idx2 >> 24)
&& len == weights[idx2 & 0xffffff])
@@ -504,7 +503,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
{
int32_t table_size;
const int32_t *symb_table;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
char str[c1];
unsigned int strcnt;
# else
@@ -516,7 +515,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
int32_t second;
int32_t hash;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
/* We have to convert the name to a single-byte
string. This is possible since the names
consist of ASCII characters and the internal
@@ -571,7 +570,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
{
/* Compare the byte sequence but only if
this is not part of a range. */
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
int32_t *wextra;
idx += 1 + extra[idx];
@@ -583,7 +582,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
if (! is_range)
{
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
for (c1 = 0;
(int32_t) c1 < wextra[idx];
++c1)
@@ -604,7 +603,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
/* Get the collation sequence value. */
is_seqval = 1;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
cold = wextra[1 + wextra[idx]];
# else
/* Adjust for the alignment. */
@@ -667,7 +666,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
uint32_t lcollseq;
UCHAR cend = *p++;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
/* Search in the `names' array for the characters. */
fcollseq = __collseq_table_lookup (collseq, fn);
if (fcollseq == ~((uint32_t) 0))
@@ -722,7 +721,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
{
int32_t table_size;
const int32_t *symb_table;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
char str[c1];
unsigned int strcnt;
# else
@@ -734,7 +733,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
int32_t second;
int32_t hash;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
/* We have to convert the name to a single-byte
string. This is possible since the names
consist of ASCII characters and the internal
@@ -789,7 +788,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
{
/* Compare the byte sequence but only if
this is not part of a range. */
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
int32_t *wextra;
idx += 1 + extra[idx];
@@ -800,7 +799,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
# endif
/* Get the collation sequence value. */
is_seqval = 1;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
cend = wextra[1 + wextra[idx]];
# else
/* Adjust for the alignment. */
@@ -832,7 +831,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
characters which are not mentioned in the
collation specification. */
if (
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
lcollseq == 0xffffffff ||
# endif
lcollseq <= fcollseq)
@@ -844,7 +843,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
hcollseq = cend;
else
{
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
hcollseq =
__collseq_table_lookup (collseq, cend);
if (hcollseq == ~((uint32_t) 0))
@@ -865,7 +864,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
if (lcollseq <= hcollseq && fcollseq <= hcollseq)
goto matched;
}
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
range_not_matched:
# endif
#else
@@ -899,11 +898,8 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
matched:
/* Skip the rest of the [...] that already matched. */
- do
+ while ((c = *p++) != L (']'))
{
- ignore_next:
- c = *p++;
-
if (c == L('\0'))
/* [... (unterminated) loses. */
return FNM_NOMATCH;
@@ -931,12 +927,11 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
if (c < L('a') || c >= L('z'))
{
- p = startp;
- goto ignore_next;
+ p = startp - 2;
+ break;
}
}
p += 2;
- c = *p++;
}
else if (c == L('[') && *p == L('='))
{
@@ -947,25 +942,21 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
if (c != L('=') || p[1] != L(']'))
return FNM_NOMATCH;
p += 2;
- c = *p++;
}
else if (c == L('[') && *p == L('.'))
{
- ++p;
while (1)
{
c = *++p;
- if (c == '\0')
+ if (c == L('\0'))
return FNM_NOMATCH;
- if (*p == L('.') && p[1] == L(']'))
+ if (c == L('.') && p[1] == L(']'))
break;
}
p += 2;
- c = *p++;
}
}
- while (c != L(']'));
if (not)
return FNM_NOMATCH;
}
@@ -1045,7 +1036,12 @@ END (const CHAR *pattern)
}
else if ((*p == L('?') || *p == L('*') || *p == L('+') || *p == L('@')
|| *p == L('!')) && p[1] == L('('))
- p = END (p + 1);
+ {
+ p = END (p + 1);
+ if (*p == L('\0'))
+ /* This is an invalid pattern. */
+ return pattern;
+ }
else if (*p == L(')'))
break;
@@ -1283,3 +1279,5 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
#undef STRCAT
#undef L
#undef BTOWC
+#undef WIDE_CHAR_VERSION
+#undef FINDIDX
diff --git a/posix/fork.c b/posix/fork.c
index 44b7fca56a..79540dbf31 100644
--- a/posix/fork.c
+++ b/posix/fork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/fpathconf.c b/posix/fpathconf.c
index 50bb591c3a..c4f1cfec29 100644
--- a/posix/fpathconf.c
+++ b/posix/fpathconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/gai_strerror.c b/posix/gai_strerror.c
index ab36419de4..cb304796bd 100644
--- a/posix/gai_strerror.c
+++ b/posix/gai_strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/get_child_max.c b/posix/get_child_max.c
index ae15b3dbf2..054e3f023e 100644
--- a/posix/get_child_max.c
+++ b/posix/get_child_max.c
@@ -1,5 +1,5 @@
/* Get POSIX {CHILD_MAX} run-time limit value. Stub version (no limit).
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 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
diff --git a/posix/getaddrinfo.c b/posix/getaddrinfo.c
index ad3d70bcd2..5e6cdc460b 100644
--- a/posix/getaddrinfo.c
+++ b/posix/getaddrinfo.c
@@ -1,5 +1,5 @@
/* Stub version of getaddrinfo function.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 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
diff --git a/posix/getconf-speclist.c b/posix/getconf-speclist.c
index 065b0b4b10..9c6c3c14e4 100644
--- a/posix/getconf-speclist.c
+++ b/posix/getconf-speclist.c
@@ -1,5 +1,5 @@
/* List POSIX compilation environments for this libc.
- Copyright (C) 2012-2014 Free Software Foundation, Inc.
+ Copyright (C) 2012-2015 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
diff --git a/posix/getconf.c b/posix/getconf.c
index db6acc4c45..4cf606ae5f 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@@ -26,6 +26,9 @@
#include "../version.h"
#define PACKAGE _libc_intl_domainname
+#define NEED_SPEC_ARRAY 1
+#include <posix-conf-vars.h>
+
struct conf
{
const char *name;
@@ -35,996 +38,358 @@ struct conf
static const struct conf vars[] =
{
-#ifdef _PC_LINK_MAX
{ "LINK_MAX", _PC_LINK_MAX, PATHCONF },
-#endif
-#ifdef _PC_LINK_MAX
{ "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
-#endif
-#ifdef _PC_MAX_CANON
{ "MAX_CANON", _PC_MAX_CANON, PATHCONF },
-#endif
-#ifdef _PC_MAX_CANON
{ "_POSIX_MAX_CANON", _PC_MAX_CANON, PATHCONF },
-#endif
-#ifdef _PC_MAX_INPUT
{ "MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
-#endif
-#ifdef _PC_MAX_INPUT
{ "_POSIX_MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
-#endif
-#ifdef _PC_NAME_MAX
{ "NAME_MAX", _PC_NAME_MAX, PATHCONF },
-#endif
-#ifdef _PC_NAME_MAX
{ "_POSIX_NAME_MAX", _PC_NAME_MAX, PATHCONF },
-#endif
-#ifdef _PC_PATH_MAX
{ "PATH_MAX", _PC_PATH_MAX, PATHCONF },
-#endif
-#ifdef _PC_PATH_MAX
{ "_POSIX_PATH_MAX", _PC_PATH_MAX, PATHCONF },
-#endif
-#ifdef _PC_PIPE_BUF
{ "PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
-#endif
-#ifdef _PC_PIPE_BUF
{ "_POSIX_PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
-#endif
-#ifdef _PC_SOCK_MAXBUF
{ "SOCK_MAXBUF", _PC_SOCK_MAXBUF, PATHCONF },
-#endif
-#ifdef _PC_ASYNC_IO
{ "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF },
-#endif
-#ifdef _PC_CHOWN_RESTRICTED
{ "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF },
-#endif
-#ifdef _PC_NO_TRUNC
{ "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF },
-#endif
-#ifdef _PC_PRIO_IO
{ "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF },
-#endif
-#ifdef _PC_SYNC_IO
{ "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF },
-#endif
-#ifdef _PC_VDISABLE
{ "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF },
-#endif
-#ifdef _SC_ARG_MAX
{ "ARG_MAX", _SC_ARG_MAX, SYSCONF },
-#endif
-#ifdef _SC_ATEXIT_MAX
{ "ATEXIT_MAX", _SC_ATEXIT_MAX, SYSCONF },
-#endif
-#ifdef _SC_CHAR_BIT
{ "CHAR_BIT", _SC_CHAR_BIT, SYSCONF },
-#endif
-#ifdef _SC_CHAR_MAX
{ "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
-#endif
-#ifdef _SC_CHAR_MIN
{ "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
-#endif
-#ifdef _SC_CHILD_MAX
{ "CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
-#endif
-#ifdef _SC_CLK_TCK
{ "CLK_TCK", _SC_CLK_TCK, SYSCONF },
-#endif
-#ifdef _SC_INT_MAX
{ "INT_MAX", _SC_INT_MAX, SYSCONF },
-#endif
-#ifdef _SC_INT_MIN
{ "INT_MIN", _SC_INT_MIN, SYSCONF },
-#endif
-#ifdef _SC_UIO_MAXIOV
{ "IOV_MAX", _SC_UIO_MAXIOV, SYSCONF },
-#endif
-#ifdef _SC_LOGIN_NAME_MAX
{ "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_LONG_BIT
{ "LONG_BIT", _SC_LONG_BIT, SYSCONF },
-#endif
-#ifdef _SC_MB_LEN_MAX
{ "MB_LEN_MAX", _SC_MB_LEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_NGROUPS_MAX
{ "NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
-#endif
-#ifdef _SC_NL_ARGMAX
{ "NL_ARGMAX", _SC_NL_ARGMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_LANGMAX
{ "NL_LANGMAX", _SC_NL_LANGMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_MSGMAX
{ "NL_MSGMAX", _SC_NL_MSGMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_NMAX
{ "NL_NMAX", _SC_NL_NMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_SETMAX
{ "NL_SETMAX", _SC_NL_SETMAX, SYSCONF },
-#endif
-#ifdef _SC_NL_TEXTMAX
{ "NL_TEXTMAX", _SC_NL_TEXTMAX, SYSCONF },
-#endif
-#ifdef _SC_GETGR_R_SIZE_MAX
{ "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_GETPW_R_SIZE_MAX
{ "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_NZERO
{ "NZERO", _SC_NZERO, SYSCONF },
-#endif
-#ifdef _SC_OPEN_MAX
{ "OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_PAGESIZE
{ "PAGESIZE", _SC_PAGESIZE, SYSCONF },
-#endif
-#ifdef _SC_PAGESIZE
{ "PAGE_SIZE", _SC_PAGESIZE, SYSCONF },
-#endif
-#ifdef _SC_PASS_MAX
{ "PASS_MAX", _SC_PASS_MAX, SYSCONF },
-#endif
-#ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
{ "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
-#endif
-#ifdef _SC_THREAD_KEYS_MAX
{ "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
-#endif
-#ifdef _SC_THREAD_STACK_MIN
{ "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
-#endif
-#ifdef _SC_THREAD_THREADS_MAX
{ "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
-#endif
-#ifdef _SC_SCHAR_MAX
{ "SCHAR_MAX", _SC_SCHAR_MAX, SYSCONF },
-#endif
-#ifdef _SC_SCHAR_MIN
{ "SCHAR_MIN", _SC_SCHAR_MIN, SYSCONF },
-#endif
-#ifdef _SC_SHRT_MAX
{ "SHRT_MAX", _SC_SHRT_MAX, SYSCONF },
-#endif
-#ifdef _SC_SHRT_MIN
{ "SHRT_MIN", _SC_SHRT_MIN, SYSCONF },
-#endif
-#ifdef _SC_SSIZE_MAX
{ "SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_TTY_NAME_MAX
{ "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_TZNAME_MAX
{ "TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_UCHAR_MAX
{ "UCHAR_MAX", _SC_UCHAR_MAX, SYSCONF },
-#endif
-#ifdef _SC_UINT_MAX
{ "UINT_MAX", _SC_UINT_MAX, SYSCONF },
-#endif
-#ifdef _SC_UIO_MAXIOV
{ "UIO_MAXIOV", _SC_UIO_MAXIOV, SYSCONF },
-#endif
-#ifdef _SC_ULONG_MAX
{ "ULONG_MAX", _SC_ULONG_MAX, SYSCONF },
-#endif
-#ifdef _SC_USHRT_MAX
{ "USHRT_MAX", _SC_USHRT_MAX, SYSCONF },
-#endif
-#ifdef _SC_WORD_BIT
{ "WORD_BIT", _SC_WORD_BIT, SYSCONF },
-#endif
-#ifdef _SC_AVPHYS_PAGES
{ "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
-#endif
-#ifdef _SC_NPROCESSORS_CONF
{ "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
-#endif
-#ifdef _SC_NPROCESSORS_ONLN
{ "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
-#endif
-#ifdef _SC_PHYS_PAGES
{ "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
-#endif
-#ifdef _SC_ARG_MAX
{ "_POSIX_ARG_MAX", _SC_ARG_MAX, SYSCONF },
-#endif
-#ifdef _SC_ASYNCHRONOUS_IO
{ "_POSIX_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO, SYSCONF },
-#endif
-#ifdef _SC_CHILD_MAX
{ "_POSIX_CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
-#endif
-#ifdef _SC_FSYNC
{ "_POSIX_FSYNC", _SC_FSYNC, SYSCONF },
-#endif
-#ifdef _SC_JOB_CONTROL
{ "_POSIX_JOB_CONTROL", _SC_JOB_CONTROL, SYSCONF },
-#endif
-#ifdef _SC_MAPPED_FILES
{ "_POSIX_MAPPED_FILES", _SC_MAPPED_FILES, SYSCONF },
-#endif
-#ifdef _SC_MEMLOCK
{ "_POSIX_MEMLOCK", _SC_MEMLOCK, SYSCONF },
-#endif
-#ifdef _SC_MEMLOCK_RANGE
{ "_POSIX_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE, SYSCONF },
-#endif
-#ifdef _SC_MEMORY_PROTECTION
{ "_POSIX_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION, SYSCONF },
-#endif
-#ifdef _SC_MESSAGE_PASSING
{ "_POSIX_MESSAGE_PASSING", _SC_MESSAGE_PASSING, SYSCONF },
-#endif
-#ifdef _SC_NGROUPS_MAX
{ "_POSIX_NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
-#endif
-#ifdef _SC_OPEN_MAX
{ "_POSIX_OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_PII
{ "_POSIX_PII", _SC_PII, SYSCONF },
-#endif
-#ifdef _SC_PII_INTERNET
{ "_POSIX_PII_INTERNET", _SC_PII_INTERNET, SYSCONF },
-#endif
-#ifdef _SC_PII_INTERNET_DGRAM
{ "_POSIX_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM, SYSCONF },
-#endif
-#ifdef _SC_PII_INTERNET_STREAM
{ "_POSIX_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI
{ "_POSIX_PII_OSI", _SC_PII_OSI, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI_CLTS
{ "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI_COTS
{ "_POSIX_PII_OSI_COTS", _SC_PII_OSI_COTS, SYSCONF },
-#endif
-#ifdef _SC_PII_OSI_M
{ "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
-#endif
-#ifdef _SC_PII_SOCKET
{ "_POSIX_PII_SOCKET", _SC_PII_SOCKET, SYSCONF },
-#endif
-#ifdef _SC_PII_XTI
{ "_POSIX_PII_XTI", _SC_PII_XTI, SYSCONF },
-#endif
-#ifdef _SC_POLL
{ "_POSIX_POLL", _SC_POLL, SYSCONF },
-#endif
-#ifdef _SC_PRIORITIZED_IO
{ "_POSIX_PRIORITIZED_IO", _SC_PRIORITIZED_IO, SYSCONF },
-#endif
-#ifdef _SC_PRIORITY_SCHEDULING
{ "_POSIX_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING, SYSCONF },
-#endif
-#ifdef _SC_REALTIME_SIGNALS
{ "_POSIX_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS, SYSCONF },
-#endif
-#ifdef _SC_SAVED_IDS
{ "_POSIX_SAVED_IDS", _SC_SAVED_IDS, SYSCONF },
-#endif
-#ifdef _SC_SELECT
{ "_POSIX_SELECT", _SC_SELECT, SYSCONF },
-#endif
-#ifdef _SC_SEMAPHORES
{ "_POSIX_SEMAPHORES", _SC_SEMAPHORES, SYSCONF },
-#endif
-#ifdef _SC_SHARED_MEMORY_OBJECTS
{ "_POSIX_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS, SYSCONF },
-#endif
-#ifdef _SC_SSIZE_MAX
{ "_POSIX_SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
-#endif
-#ifdef _SC_STREAM_MAX
{ "_POSIX_STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
-#endif
-#ifdef _SC_SYNCHRONIZED_IO
{ "_POSIX_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO, SYSCONF },
-#endif
-#ifdef _SC_THREADS
{ "_POSIX_THREADS", _SC_THREADS, SYSCONF },
-#endif
-#ifdef _SC_THREAD_ATTR_STACKADDR
{ "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
-#endif
-#ifdef _SC_THREAD_ATTR_STACKSIZE
{ "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
-#endif
-#ifdef _SC_THREAD_PRIORITY_SCHEDULING
{ "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
-#endif
-#ifdef _SC_THREAD_PRIO_INHERIT
{ "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
-#endif
-#ifdef _SC_THREAD_PRIO_PROTECT
{ "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
-#endif
-#ifdef _SC_THREAD_ROBUST_PRIO_INHERIT
{ "_POSIX_THREAD_ROBUST_PRIO_INHERIT", _SC_THREAD_ROBUST_PRIO_INHERIT,
SYSCONF },
-#endif
-#ifdef _SC_THREAD_ROBUST_PRIO_PROTECT
{ "_POSIX_THREAD_ROBUST_PRIO_PROTECT", _SC_THREAD_ROBUST_PRIO_PROTECT,
SYSCONF },
-#endif
-#ifdef _SC_THREAD_PROCESS_SHARED
{ "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
-#endif
-#ifdef _SC_THREAD_SAFE_FUNCTIONS
{ "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
-#endif
-#ifdef _SC_TIMERS
{ "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
-#endif
-#ifdef _SC_TIMER_MAX
{ "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
-#endif
-#ifdef _SC_TZNAME_MAX
{ "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_VERSION
{ "_POSIX_VERSION", _SC_VERSION, SYSCONF },
-#endif
-#ifdef _SC_T_IOV_MAX
{ "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_CRYPT
{ "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_ENH_I18N
{ "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_LEGACY
{ "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_REALTIME
{ "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_REALTIME_THREADS
{ "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_SHM
{ "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_UNIX
{ "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_VERSION
{ "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XCU_VERSION
{ "_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XPG2
{ "_XOPEN_XPG2", _SC_XOPEN_XPG2, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XPG3
{ "_XOPEN_XPG3", _SC_XOPEN_XPG3, SYSCONF },
-#endif
-#ifdef _SC_XOPEN_XPG4
{ "_XOPEN_XPG4", _SC_XOPEN_XPG4, SYSCONF },
-#endif
/* POSIX.2 */
-#ifdef _SC_BC_BASE_MAX
{ "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_DIM_MAX
{ "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_SCALE_MAX
{ "BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_STRING_MAX
{ "BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
-#endif
{ "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
-#ifdef _SC_COLL_WEIGHTS_MAX
{ "COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
-#endif
-#ifdef _SC_EQUIV_CLASS_MAX
{ "EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX, SYSCONF },
-#endif
-#ifdef _SC_EXPR_NEST_MAX
{ "EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
-#endif
-#ifdef _SC_LINE_MAX
{ "LINE_MAX", _SC_LINE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_BASE_MAX
{ "POSIX2_BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_DIM_MAX
{ "POSIX2_BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_SCALE_MAX
{ "POSIX2_BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
-#endif
-#ifdef _SC_BC_STRING_MAX
{ "POSIX2_BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_CHAR_TERM
{ "POSIX2_CHAR_TERM", _SC_2_CHAR_TERM, SYSCONF },
-#endif
-#ifdef _SC_COLL_WEIGHTS_MAX
{ "POSIX2_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_C_BIND
{ "POSIX2_C_BIND", _SC_2_C_BIND, SYSCONF },
-#endif
-#ifdef _SC_2_C_DEV
{ "POSIX2_C_DEV", _SC_2_C_DEV, SYSCONF },
-#endif
-#ifdef _SC_2_C_VERSION
{ "POSIX2_C_VERSION", _SC_2_C_VERSION, SYSCONF },
-#endif
-#ifdef _SC_EXPR_NEST_MAX
{ "POSIX2_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_FORT_DEV
{ "POSIX2_FORT_DEV", _SC_2_FORT_DEV, SYSCONF },
-#endif
-#ifdef _SC_2_FORT_RUN
{ "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
-#endif
-#ifdef _SC_LINE_MAX
{ "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
{ "POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_LOCALEDEF
{ "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
-#endif
-#ifdef _SC_RE_DUP_MAX
{ "POSIX2_RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
-#endif
-#ifdef _SC_2_SW_DEV
{ "POSIX2_SW_DEV", _SC_2_SW_DEV, SYSCONF },
-#endif
-#ifdef _SC_2_UPE
{ "POSIX2_UPE", _SC_2_UPE, SYSCONF },
-#endif
-#ifdef _SC_2_VERSION
{ "POSIX2_VERSION", _SC_2_VERSION, SYSCONF },
-#endif
-#ifdef _SC_RE_DUP_MAX
{ "RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
-#endif
-#ifdef _CS_PATH
{ "PATH", _CS_PATH, CONFSTR },
{ "CS_PATH", _CS_PATH, CONFSTR },
-#endif
/* LFS */
-#ifdef _CS_LFS_CFLAGS
{ "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS_LDFLAGS
{ "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS_LIBS
{ "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
-#endif
-#ifdef _CS_LFS_LINTFLAGS
{ "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_CFLAGS
{ "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_LDFLAGS
{ "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_LIBS
{ "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_LFS64_LINTFLAGS
{ "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
-#endif
/* Programming environments. */
-#ifdef _CS_V5_WIDTH_RESTRICTED_ENVS
{ "_XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
{ "XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
-#endif
-#ifdef _SC_XBS5_ILP32_OFF32
{ "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
{ "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
{ "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_LIBS
{ "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
{ "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_XBS5_ILP32_OFFBIG
{ "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
{ "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
{ "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
{ "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
{ "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_XBS5_LP64_OFF64
{ "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_CFLAGS
{ "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
{ "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_LIBS
{ "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
{ "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_XBS5_LPBIG_OFFBIG
{ "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
{ "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
{ "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
{ "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
{ "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_V6_ILP32_OFF32
{ "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
{ "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
{ "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
{ "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
{ "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
{ "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
{ "POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
-#endif
-#ifdef _SC_V6_ILP32_OFFBIG
{ "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
{ "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
{ "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
{ "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
{ "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_V6_LP64_OFF64
{ "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
{ "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
{ "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
{ "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
{ "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_V6_LPBIG_OFFBIG
{ "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
{ "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
{ "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
{ "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
{ "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_V7_ILP32_OFF32
{ "_POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_CFLAGS
{ "POSIX_V7_ILP32_OFF32_CFLAGS", _CS_POSIX_V7_ILP32_OFF32_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
{ "POSIX_V7_ILP32_OFF32_LDFLAGS", _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_LIBS
{ "POSIX_V7_ILP32_OFF32_LIBS", _CS_POSIX_V7_ILP32_OFF32_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
{ "POSIX_V7_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _CS_V7_WIDTH_RESTRICTED_ENVS
{ "_POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
{ "POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
-#endif
-#ifdef _SC_V7_ILP32_OFFBIG
{ "_POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
{ "POSIX_V7_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
{ "POSIX_V7_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_LIBS
{ "POSIX_V7_ILP32_OFFBIG_LIBS", _CS_POSIX_V7_ILP32_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
{ "POSIX_V7_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_V7_LP64_OFF64
{ "_POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_CFLAGS
{ "POSIX_V7_LP64_OFF64_CFLAGS", _CS_POSIX_V7_LP64_OFF64_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_LDFLAGS
{ "POSIX_V7_LP64_OFF64_LDFLAGS", _CS_POSIX_V7_LP64_OFF64_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_LIBS
{ "POSIX_V7_LP64_OFF64_LIBS", _CS_POSIX_V7_LP64_OFF64_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LP64_OFF64_LINTFLAGS
{ "POSIX_V7_LP64_OFF64_LINTFLAGS", _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_V7_LPBIG_OFFBIG
{ "_POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG, SYSCONF },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
{ "POSIX_V7_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
{ "POSIX_V7_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
{ "POSIX_V7_LPBIG_OFFBIG_LIBS", _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, CONFSTR },
-#endif
-#ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
{ "POSIX_V7_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
-#endif
-#ifdef _SC_ADVISORY_INFO
{ "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
-#endif
-#ifdef _SC_BARRIERS
{ "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
-#endif
-#ifdef _SC_BASE
{ "_POSIX_BASE", _SC_BASE, SYSCONF },
-#endif
-#ifdef _SC_C_LANG_SUPPORT
{ "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
-#endif
-#ifdef _SC_C_LANG_SUPPORT_R
{ "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
-#endif
-#ifdef _SC_CLOCK_SELECTION
{ "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
-#endif
-#ifdef _SC_CPUTIME
{ "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
-#endif
-#ifdef _SC_THREAD_CPUTIME
{ "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
-#endif
-#ifdef _SC_DEVICE_SPECIFIC
{ "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
-#endif
-#ifdef _SC_DEVICE_SPECIFIC_R
{ "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
-#endif
-#ifdef _SC_FD_MGMT
{ "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
-#endif
-#ifdef _SC_FIFO
{ "_POSIX_FIFO", _SC_FIFO, SYSCONF },
-#endif
-#ifdef _SC_PIPE
{ "_POSIX_PIPE", _SC_PIPE, SYSCONF },
-#endif
-#ifdef _SC_FILE_ATTRIBUTES
{ "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
-#endif
-#ifdef _SC_FILE_LOCKING
{ "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
-#endif
-#ifdef _SC_FILE_SYSTEM
{ "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
-#endif
-#ifdef _SC_MONOTONIC_CLOCK
{ "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
-#endif
-#ifdef _SC_MULTI_PROCESS
{ "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
-#endif
-#ifdef _SC_SINGLE_PROCESS
{ "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
-#endif
-#ifdef _SC_NETWORKING
{ "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
-#endif
-#ifdef _SC_READER_WRITER_LOCKS
{ "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
-#endif
-#ifdef _SC_SPIN_LOCKS
{ "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
-#endif
-#ifdef _SC_REGEXP
{ "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
-#endif
-#ifdef _SC_REGEX_VERSION
{ "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
-#endif
-#ifdef _SC_SHELL
{ "_POSIX_SHELL", _SC_SHELL, SYSCONF },
-#endif
-#ifdef _SC_SIGNALS
{ "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
-#endif
-#ifdef _SC_SPAWN
{ "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
-#endif
-#ifdef _SC_SPORADIC_SERVER
{ "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
-#endif
-#ifdef _SC_THREAD_SPORADIC_SERVER
{ "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
-#endif
-#ifdef _SC_SYSTEM_DATABASE
{ "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
-#endif
-#ifdef _SC_SYSTEM_DATABASE_R
{ "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
-#endif
-#ifdef _SC_TIMEOUTS
{ "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
-#endif
-#ifdef _SC_TYPED_MEMORY_OBJECTS
{ "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
-#endif
-#ifdef _SC_USER_GROUPS
{ "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
-#endif
-#ifdef _SC_USER_GROUPS_R
{ "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
-#endif
-#ifdef _SC_2_PBS
{ "POSIX2_PBS", _SC_2_PBS, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_ACCOUNTING
{ "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_LOCATE
{ "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_TRACK
{ "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
-#endif
-#ifdef _SC_2_PBS_MESSAGE
{ "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
-#endif
-#ifdef _SC_SYMLOOP_MAX
{ "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
-#endif
-#ifdef _SC_STREAM_MAX
{ "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
-#endif
-#ifdef _SC_AIO_LISTIO_MAX
{ "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
-#endif
-#ifdef _SC_AIO_MAX
{ "AIO_MAX", _SC_AIO_MAX, SYSCONF },
-#endif
-#ifdef _SC_AIO_PRIO_DELTA_MAX
{ "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
-#endif
-#ifdef _SC_DELAYTIMER_MAX
{ "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
-#endif
-#ifdef _SC_HOST_NAME_MAX
{ "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_LOGIN_NAME_MAX
{ "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
-#endif
-#ifdef _SC_MQ_OPEN_MAX
{ "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
-#endif
-#ifdef _SC_MQ_PRIO_MAX
{ "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
-#endif
-#ifdef _SC_DEVICE_IO
{ "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
-#endif
-#ifdef _SC_TRACE
{ "_POSIX_TRACE", _SC_TRACE, SYSCONF },
-#endif
-#ifdef _SC_TRACE_EVENT_FILTER
{ "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
-#endif
-#ifdef _SC_TRACE_INHERIT
{ "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
-#endif
-#ifdef _SC_TRACE_LOG
{ "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
-#endif
-#ifdef _SC_RTSIG_MAX
{ "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
-#endif
-#ifdef _SC_SEM_NSEMS_MAX
{ "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
-#endif
-#ifdef _SC_SEM_VALUE_MAX
{ "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
-#endif
-#ifdef _SC_SIGQUEUE_MAX
{ "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
-#endif
-#ifdef _PC_FILESIZEBITS
{ "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
-#endif
-#ifdef _PC_ALLOC_SIZE_MIN
{ "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
-#endif
-#ifdef _PC_REC_INCR_XFER_SIZE
{ "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
-#endif
-#ifdef _PC_REC_MAX_XFER_SIZE
{ "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
-#endif
-#ifdef _PC_REC_MIN_XFER_SIZE
{ "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
-#endif
-#ifdef _PC_REC_XFER_ALIGN
{ "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
-#endif
-#ifdef _PC_SYMLINK_MAX
{ "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
-#endif
-#ifdef _CS_GNU_LIBC_VERSION
{ "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
-#endif
-#ifdef _CS_GNU_LIBPTHREAD_VERSION
{ "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
-#endif
-#ifdef _PC_2_SYMLINKS
{ "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
-#endif
-#ifdef _SC_LEVEL1_ICACHE_SIZE
{ "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_ICACHE_ASSOC
{ "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_ICACHE_LINESIZE
{ "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_DCACHE_SIZE
{ "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_DCACHE_ASSOC
{ "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL1_DCACHE_LINESIZE
{ "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL2_CACHE_SIZE
{ "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL2_CACHE_ASSOC
{ "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL2_CACHE_LINESIZE
{ "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL3_CACHE_SIZE
{ "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL3_CACHE_ASSOC
{ "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL3_CACHE_LINESIZE
{ "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL4_CACHE_SIZE
{ "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
-#endif
-#ifdef _SC_LEVEL4_CACHE_ASSOC
{ "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
-#endif
-#ifdef _SC_LEVEL4_CACHE_LINESIZE
{ "LEVEL4_CACHE_LINESIZE", _SC_LEVEL4_CACHE_LINESIZE, SYSCONF },
-#endif
-#ifdef _SC_IPV6
{ "IPV6", _SC_IPV6, SYSCONF },
-#endif
-#ifdef _SC_RAW_SOCKETS
{ "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
-#endif
+
+ { "_POSIX_IPV6", _SC_IPV6, SYSCONF },
+ { "_POSIX_RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
{ NULL, 0, SYSCONF }
};
-static const struct { const char *name; int num; } specs[] =
- {
- { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32 },
- { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG },
- { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64 },
- { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG },
- { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
- { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
- { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
- { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG },
- { "POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32 },
- { "POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG },
- { "POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64 },
- { "POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG },
- };
-static const int nspecs = sizeof (specs) / sizeof (specs[0]);
-
extern const char *__progname;
@@ -1104,7 +469,7 @@ main (int argc, char *argv[])
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2014");
+"), "2015");
printf (gettext ("Written by %s.\n"), "Roland McGrath");
return 0;
}
@@ -1163,7 +528,7 @@ environment SPEC.\n\n"));
/* Check for the specifications we know. */
if (spec != NULL)
{
- int i;
+ size_t i;
for (i = 0; i < nspecs; ++i)
if (strcmp (spec, specs[i].name) == 0)
break;
diff --git a/posix/getegid.c b/posix/getegid.c
index fa86d9d790..dbf28469e8 100644
--- a/posix/getegid.c
+++ b/posix/getegid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/geteuid.c b/posix/geteuid.c
index 19f185b2b6..ff34d85e3a 100644
--- a/posix/geteuid.c
+++ b/posix/geteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getgid.c b/posix/getgid.c
index c480effd2e..e50c5bd479 100644
--- a/posix/getgid.c
+++ b/posix/getgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getgroups.c b/posix/getgroups.c
index 3fab310945..d8288129dc 100644
--- a/posix/getgroups.c
+++ b/posix/getgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getopt.c b/posix/getopt.c
index 2d481f1c7f..d30530f939 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -2,7 +2,7 @@
NOTE: getopt is part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
- Copyright (C) 1987-2014 Free Software Foundation, Inc.
+ Copyright (C) 1987-2015 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
@@ -585,7 +585,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
char *buf = NULL;
size_t buflen = 0;
- FILE *fp = open_memstream (&buf, &buflen);
+ FILE *fp = __open_memstream (&buf, &buflen);
if (fp != NULL)
{
fprintf (fp,
@@ -601,7 +601,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
fputc_unlocked ('\n', fp);
- if (__builtin_expect (fclose (fp) != EOF, 1))
+ if (__glibc_likely (fclose (fp) != EOF))
{
_IO_flockfile (stderr);
diff --git a/posix/getopt.h b/posix/getopt.h
index da1a01ffa8..56fa905c4c 100644
--- a/posix/getopt.h
+++ b/posix/getopt.h
@@ -1,5 +1,5 @@
/* Declarations for getopt.
- Copyright (C) 1989-2014 Free Software Foundation, Inc.
+ Copyright (C) 1989-2015 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
diff --git a/posix/getopt1.c b/posix/getopt1.c
index 75d6b9c1a3..b1af40e9b7 100644
--- a/posix/getopt1.c
+++ b/posix/getopt1.c
@@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987-2014 Free Software Foundation, Inc.
+ Copyright (C) 1987-2015 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
diff --git a/posix/getopt_init.c b/posix/getopt_init.c
index 06ec2b3c59..ff3bc2c1c1 100644
--- a/posix/getopt_init.c
+++ b/posix/getopt_init.c
@@ -1,5 +1,5 @@
/* Perform additional initialization for getopt functions in GNU libc.
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
diff --git a/posix/getopt_int.h b/posix/getopt_int.h
index d255c8eee4..03d6227753 100644
--- a/posix/getopt_int.h
+++ b/posix/getopt_int.h
@@ -1,5 +1,5 @@
/* Internal declarations for getopt.
- Copyright (C) 1989-2014 Free Software Foundation, Inc.
+ Copyright (C) 1989-2015 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
diff --git a/posix/getpgid.c b/posix/getpgid.c
index f6b02a11a1..05f72c34ab 100644
--- a/posix/getpgid.c
+++ b/posix/getpgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getpgrp.c b/posix/getpgrp.c
index e195b4c4ea..88e8eca638 100644
--- a/posix/getpgrp.c
+++ b/posix/getpgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getpid.c b/posix/getpid.c
index 9bab75ed3c..18649f7c3f 100644
--- a/posix/getpid.c
+++ b/posix/getpid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getppid.c b/posix/getppid.c
index cf16c3cbab..20f7510b2d 100644
--- a/posix/getppid.c
+++ b/posix/getppid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getresgid.c b/posix/getresgid.c
index fd0072f317..fa75d0be30 100644
--- a/posix/getresgid.c
+++ b/posix/getresgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getresuid.c b/posix/getresuid.c
index 967c2ecf21..6a07455572 100644
--- a/posix/getresuid.c
+++ b/posix/getresuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/getsid.c b/posix/getsid.c
index 19893a3a12..fc19096696 100644
--- a/posix/getsid.c
+++ b/posix/getsid.c
@@ -1,5 +1,5 @@
/* getsid -- Return session ID of a process. Stub version.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/posix/getuid.c b/posix/getuid.c
index 6fb9238450..b02206528a 100644
--- a/posix/getuid.c
+++ b/posix/getuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/glob.c b/posix/glob.c
index f1431088a2..d65e55dcd6 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -354,7 +354,7 @@ glob (pattern, flags, errfunc, pglob)
/* It is an illegal expression. */
illegal_brace:
#ifdef _LIBC
- if (__builtin_expect (!alloca_onealt, 0))
+ if (__glibc_unlikely (!alloca_onealt))
#endif
free (onealt);
return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
@@ -404,7 +404,7 @@ glob (pattern, flags, errfunc, pglob)
if (result && result != GLOB_NOMATCH)
{
#ifdef _LIBC
- if (__builtin_expect (!alloca_onealt, 0))
+ if (__glibc_unlikely (!alloca_onealt))
#endif
free (onealt);
if (!(flags & GLOB_APPEND))
@@ -425,7 +425,7 @@ glob (pattern, flags, errfunc, pglob)
}
#ifdef _LIBC
- if (__builtin_expect (!alloca_onealt, 0))
+ if (__glibc_unlikely (!alloca_onealt))
#endif
free (onealt);
@@ -488,7 +488,7 @@ glob (pattern, flags, errfunc, pglob)
}
else
{
- if (__builtin_expect (pattern[0] == '\0', 0))
+ if (__glibc_unlikely (pattern[0] == '\0'))
{
dirs.gl_pathv = NULL;
goto no_matches;
@@ -619,7 +619,7 @@ glob (pattern, flags, errfunc, pglob)
buflen = 20;
name = alloca_account (buflen, alloca_used);
- success = getlogin_r (name, buflen) == 0;
+ success = __getlogin_r (name, buflen) == 0;
if (success)
{
struct passwd *p;
@@ -671,7 +671,7 @@ glob (pattern, flags, errfunc, pglob)
2 * pwbuflen);
if (newp == NULL)
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
retval = GLOB_NOSPACE;
goto out;
@@ -717,7 +717,7 @@ glob (pattern, flags, errfunc, pglob)
{
if (flags & GLOB_TILDE_CHECK)
{
- if (__builtin_expect (malloc_home_dir, 0))
+ if (__glibc_unlikely (malloc_home_dir))
free (home_dir);
retval = GLOB_NOMATCH;
goto out;
@@ -730,7 +730,7 @@ glob (pattern, flags, errfunc, pglob)
/* Now construct the full directory. */
if (dirname[1] == '\0')
{
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
dirname = home_dir;
@@ -750,7 +750,7 @@ glob (pattern, flags, errfunc, pglob)
newp = malloc (home_len + dirlen);
if (newp == NULL)
{
- if (__builtin_expect (malloc_home_dir, 0))
+ if (__glibc_unlikely (malloc_home_dir))
free (home_dir);
retval = GLOB_NOSPACE;
goto out;
@@ -760,7 +760,7 @@ glob (pattern, flags, errfunc, pglob)
mempcpy (mempcpy (newp, home_dir, home_len),
&dirname[1], dirlen);
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
dirname = newp;
@@ -859,7 +859,7 @@ glob (pattern, flags, errfunc, pglob)
if (pwtmpbuf == NULL)
{
nomem_getpw:
- if (__builtin_expect (malloc_user_name, 0))
+ if (__glibc_unlikely (malloc_user_name))
free (user_name);
retval = GLOB_NOSPACE;
goto out;
@@ -884,7 +884,7 @@ glob (pattern, flags, errfunc, pglob)
2 * buflen);
if (newp == NULL)
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
goto nomem_getpw;
}
@@ -897,7 +897,7 @@ glob (pattern, flags, errfunc, pglob)
p = getpwnam (user_name);
# endif
- if (__builtin_expect (malloc_user_name, 0))
+ if (__glibc_unlikely (malloc_user_name))
free (user_name);
/* If we found a home directory use this. */
@@ -906,7 +906,7 @@ glob (pattern, flags, errfunc, pglob)
size_t home_len = strlen (p->pw_dir);
size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
malloc_dirname = 0;
@@ -918,7 +918,7 @@ glob (pattern, flags, errfunc, pglob)
dirname = malloc (home_len + rest_len + 1);
if (dirname == NULL)
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
retval = GLOB_NOSPACE;
goto out;
@@ -931,12 +931,12 @@ glob (pattern, flags, errfunc, pglob)
dirlen = home_len + rest_len;
dirname_modified = 1;
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
}
else
{
- if (__builtin_expect (malloc_pwtmpbuf, 0))
+ if (__glibc_unlikely (malloc_pwtmpbuf))
free (pwtmpbuf);
if (flags & GLOB_TILDE_CHECK)
@@ -1035,7 +1035,7 @@ glob (pattern, flags, errfunc, pglob)
*(char *) &dirname[--dirlen] = '\0';
}
- if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) != 0, 0))
+ if (__glibc_unlikely ((flags & GLOB_ALTDIRFUNC) != 0))
{
/* Use the alternative access functions also in the recursive
call. */
@@ -1253,7 +1253,7 @@ glob (pattern, flags, errfunc, pglob)
}
out:
- if (__builtin_expect (malloc_dirname, 0))
+ if (__glibc_unlikely (malloc_dirname))
free (dirname);
return retval;
@@ -1530,7 +1530,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
of the function to copy this name into the result. */
flags |= GLOB_NOCHECK;
- if (__builtin_expect (!alloca_fullname, 0))
+ if (__glibc_unlikely (!alloca_fullname))
free (fullname);
}
else
@@ -1573,7 +1573,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
}
d64buf;
- if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
+ if (__glibc_unlikely (flags & GLOB_ALTDIRFUNC))
{
struct dirent *d32 = (*pglob->gl_readdir) (stream);
if (d32 != NULL)
@@ -1732,7 +1732,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
if (stream != NULL)
{
save = errno;
- if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
+ if (__glibc_unlikely (flags & GLOB_ALTDIRFUNC))
(*pglob->gl_closedir) (stream);
else
closedir (stream);
diff --git a/posix/glob.h b/posix/glob.h
index 9c5f37fc87..035ce08bfd 100644
--- a/posix/glob.h
+++ b/posix/glob.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -45,7 +45,7 @@ typedef __SIZE_TYPE__ size_t;
#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */
#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
-#if !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU
+#if !defined __USE_POSIX2 || defined __USE_MISC
# define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
# define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
diff --git a/posix/glob64.c b/posix/glob64.c
index 73f07c12b4..56ede77073 100644
--- a/posix/glob64.c
+++ b/posix/glob64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 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
diff --git a/posix/globtest.c b/posix/globtest.c
index 0a1bcbc1ab..d5e77d31cb 100644
--- a/posix/globtest.c
+++ b/posix/globtest.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 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
diff --git a/posix/globtest.sh b/posix/globtest.sh
index d76fc6c772..7c9f590167 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -1,6 +1,6 @@
#! /bin/bash
# Test for glob(3).
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2015 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
@@ -40,8 +40,6 @@ esac
# Since we use `sort' we must make sure to use the same locale everywhere.
LC_ALL=C
export LC_ALL
-LANG=C
-export LANG
# Create the arena
testdir=${common_objpfx}posix/globtest-dir
diff --git a/posix/group_member.c b/posix/group_member.c
index ca85bba19f..032b1cea5b 100644
--- a/posix/group_member.c
+++ b/posix/group_member.c
@@ -1,5 +1,5 @@
/* `group_member' -- test if process is in a given group.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 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
diff --git a/posix/nanosleep.c b/posix/nanosleep.c
index 19111e3247..5736b9158c 100644
--- a/posix/nanosleep.c
+++ b/posix/nanosleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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,14 +21,13 @@
/* Pause execution for a number of nanoseconds. */
int
-__libc_nanosleep (const struct timespec *requested_time,
- struct timespec *remaining)
+__nanosleep (const struct timespec *requested_time,
+ struct timespec *remaining)
{
__set_errno (ENOSYS);
return -1;
}
stub_warning (nanosleep)
-weak_alias (__libc_nanosleep, __nanosleep)
libc_hidden_def (__nanosleep)
-weak_alias (__libc_nanosleep, nanosleep)
+weak_alias (__nanosleep, nanosleep)
diff --git a/posix/pathconf.c b/posix/pathconf.c
index 5e3892bdc9..2343d8dcdf 100644
--- a/posix/pathconf.c
+++ b/posix/pathconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/pause.c b/posix/pause.c
index e5db02c40f..99aba0110e 100644
--- a/posix/pause.c
+++ b/posix/pause.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/posix-conf-vars.h b/posix/posix-conf-vars.h
new file mode 100644
index 0000000000..4661f00eb6
--- /dev/null
+++ b/posix/posix-conf-vars.h
@@ -0,0 +1,48 @@
+/* Macros to check if a POSIX configuration variable is defined or set.
+
+ Copyright (C) 1991-2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _POSIX_CONF_VARS_H
+#define _POSIX_CONF_VARS_H
+
+/* The script gen-posix-conf-vars.awk generates the header
+ posix-conf-vars-def.h from the list file posix-conf-vars.list and defines
+ CONF_DEF_* macros for each entry in the list file set to either of
+ CONF_DEF_UNDEFINED, CONF_DEF_DEFINED_SET or CONF_DEF_DEFINED_UNSET. To
+ check configuration variables within glibc code, use the configuration macro
+ functions instead of checking for definitions of the macros. */
+
+#include <posix-conf-vars-def.h>
+
+#define CONF_DEF_UNDEFINED 1
+#define CONF_DEF_DEFINED_SET 2
+#define CONF_DEF_DEFINED_UNSET 3
+
+/* The configuration variable is not defined. */
+#define CONF_IS_UNDEFINED(conf) (CONF_DEF##conf == CONF_DEF_UNDEFINED)
+
+/* The configuration variable is defined. It may or may not be set. */
+#define CONF_IS_DEFINED(conf) (CONF_DEF##conf != CONF_DEF_UNDEFINED)
+
+/* The configuration variable is defined and set. */
+#define CONF_IS_DEFINED_SET(conf) (CONF_DEF##conf == CONF_DEF_DEFINED_SET)
+
+/* The configuration variable is defined but not set. */
+#define CONF_IS_DEFINED_UNSET(conf) (CONF_DEF##conf == CONF_DEF_DEFINED_UNSET)
+
+#endif
diff --git a/posix/posix-conf-vars.list b/posix/posix-conf-vars.list
new file mode 100644
index 0000000000..601bc2fd33
--- /dev/null
+++ b/posix/posix-conf-vars.list
@@ -0,0 +1,113 @@
+# Configuration variables identified by getconf. The heading of each section
+# is of the format TYPE PREFIX SC_PREFIX with the opening curly brace on the
+# same line. TYPE can either be SYSCONF, PATHCONF, CONFSTR or SPEC. In the
+# absence of SC_PREFIX, _SC is used as the SC_PREFIX. Variable names are put
+# one on each line with a curly brace on its own line ending the section.
+
+SPEC POSIX {
+ V6_ILP32_OFF32
+ V6_ILP32_OFFBIG
+ V6_LP64_OFF64
+ V6_LPBIG_OFFBIG
+ V7_ILP32_OFF32
+ V7_ILP32_OFFBIG
+ V7_LP64_OFF64
+ V7_LPBIG_OFFBIG
+}
+
+SYSCONF POSIX {
+ ADVISORY_INFO
+ ARG_MAX
+ ASYNCHRONOUS_IO
+ BARRIERS
+ BASE
+ CHILD_MAX
+ C_LANG_SUPPORT
+ C_LANG_SUPPORT_R
+ CLOCK_SELECTION
+ CPUTIME
+ DEVICE_IO
+ DEVICE_SPECIFIC
+ DEVICE_SPECIFIC_R
+ FD_MGMT
+ FIFO
+ FILE_ATTRIBUTES
+ FILE_LOCKING
+ FILE_SYSTEM
+ FSYNC
+ JOB_CONTROL
+ MAPPED_FILES
+ MEMLOCK
+ MEMLOCK_RANGE
+ MEMORY_PROTECTION
+ MESSAGE_PASSING
+ MONOTONIC_CLOCK
+ MULTI_PROCESS
+ NETWORKING
+ NGROUPS_MAX
+ OPEN_MAX
+ PII
+ PII_INTERNET
+ PII_INTERNET_DGRAM
+ PII_INTERNET_STREAM
+ PII_OSI
+ PII_OSI_CLTS
+ PII_OSI_COTS
+ PII_OSI_M
+ PII_SOCKET
+ PII_XTI
+ PIPE
+ POLL
+ PRIORITIZED_IO
+ PRIORITY_SCHEDULING
+ READER_WRITER_LOCKS
+ REALTIME_SIGNALS
+ REGEXP
+ SAVED_IDS
+ SELECT
+ SEMAPHORES
+ SHARED_MEMORY_OBJECTS
+ SHELL
+ SIGNALS
+ SINGLE_PROCESS
+ SPAWN
+ SPIN_LOCKS
+ SPORADIC_SERVER
+ SSIZE_MAX
+ STREAM_MAX
+ SYNCHRONIZED_IO
+ SYSTEM_DATABASE
+ SYSTEM_DATABASE_R
+ THREAD_ATTR_STACKADDR
+ THREAD_ATTR_STACKSIZE
+ THREAD_CPUTIME
+ THREAD_PRIO_INHERIT
+ THREAD_PRIO_PROTECT
+ THREAD_PRIORITY_SCHEDULING
+ THREAD_PROCESS_SHARED
+ THREADS
+ THREAD_SAFE_FUNCTIONS
+ THREAD_SPORADIC_SERVER
+ TIMEOUTS
+ TIMERS
+ TRACE
+ TRACE_EVENT_FILTER
+ TRACE_INHERIT
+ TRACE_LOG
+ TYPED_MEMORY_OBJECTS
+ TZNAME_MAX
+ USER_GROUPS
+ USER_GROUPS_R
+ VERSION
+# Additional variables not in getconf.
+ THREAD_DESTRUCTOR_ITERATIONS
+ IPV6
+ RAW_SOCKETS
+}
+
+SPEC XBS5 _SC_XBS5 {
+ ILP32_OFF32
+ ILP32_OFFBIG
+ LP64_OFF64
+ LPBIG_OFFBIG
+}
diff --git a/posix/posix-envs.def b/posix/posix-envs.def
index 05043e9d56..312e8cb84d 100644
--- a/posix/posix-envs.def
+++ b/posix/posix-envs.def
@@ -1,5 +1,5 @@
/* Handle POSIX compilation environments that may or may not be present.
- Copyright (C) 2012-2014 Free Software Foundation, Inc.
+ Copyright (C) 2012-2015 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
@@ -42,35 +42,38 @@
defined. These are called with arguments V5, V6, V7 before and
after the relevant groups of environments. */
+#define NEED_SPEC_ARRAY 0
+#include <posix-conf-vars.h>
+
START_ENV_GROUP (V7)
-#if _POSIX_V7_ILP32_OFF32 > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V7_ILP32_OFF32)
KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
-#elif defined _POSIX_V7_ILP32_OFF32
+#elif CONF_IS_DEFINED (_POSIX_V7_ILP32_OFF32)
KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
#else
UNKNOWN_ENVIRONMENT (V7, POSIX_V7, ILP32_OFF32)
#endif
-#if _POSIX_V7_ILP32_OFFBIG > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V7_ILP32_OFFBIG)
KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
-#elif defined _POSIX_V7_ILP32_OFFBIG
+#elif CONF_IS_DEFINED (_POSIX_V7_ILP32_OFFBIG)
KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
#else
UNKNOWN_ENVIRONMENT (V7, POSIX_V7, ILP32_OFFBIG)
#endif
-#if _POSIX_V7_LP64_OFF64 > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V7_LP64_OFF64)
KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
-#elif defined _POSIX_V7_LP64_OFF64
+#elif CONF_IS_DEFINED (_POSIX_V7_LP64_OFF64)
KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
#else
UNKNOWN_ENVIRONMENT (V7, POSIX_V7, LP64_OFF64)
#endif
-#if _POSIX_V7_LPBIG_OFFBIG > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V7_LPBIG_OFFBIG)
KNOWN_PRESENT_ENVIRONMENT (V7, POSIX_V7, LPBIG_OFFBIG)
-#elif defined _POSIX_V7_LPBIG_OFFBIG
+#elif CONF_IS_DEFINED (_POSIX_V7_LPBIG_OFFBIG)
KNOWN_ABSENT_ENVIRONMENT (V7, POSIX_V7, LPBIG_OFFBIG)
#else
UNKNOWN_ENVIRONMENT (V7, POSIX_V7, LPBIG_OFFBIG)
@@ -80,33 +83,33 @@ END_ENV_GROUP (V7)
START_ENV_GROUP (V6)
-#if _POSIX_V6_ILP32_OFF32 > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V6_ILP32_OFF32)
KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
-#elif defined _POSIX_V6_ILP32_OFF32
+#elif CONF_IS_DEFINED (_POSIX_V6_ILP32_OFF32)
KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
#else
UNKNOWN_ENVIRONMENT (V6, POSIX_V6, ILP32_OFF32)
#endif
-#if _POSIX_V6_ILP32_OFFBIG > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V6_ILP32_OFFBIG)
KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
-#elif defined _POSIX_V6_ILP32_OFFBIG
+#elif CONF_IS_DEFINED (_POSIX_V6_ILP32_OFFBIG)
KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
#else
UNKNOWN_ENVIRONMENT (V6, POSIX_V6, ILP32_OFFBIG)
#endif
-#if _POSIX_V6_LP64_OFF64 > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V6_LP64_OFF64)
KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
-#elif defined _POSIX_V6_LP64_OFF64
+#elif CONF_IS_DEFINED (_POSIX_V6_LP64_OFF64)
KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
#else
UNKNOWN_ENVIRONMENT (V6, POSIX_V6, LP64_OFF64)
#endif
-#if _POSIX_V6_LPBIG_OFFBIG > 0
+#if CONF_IS_DEFINED_SET (_POSIX_V6_LPBIG_OFFBIG)
KNOWN_PRESENT_ENVIRONMENT (V6, POSIX_V6, LPBIG_OFFBIG)
-#elif defined _POSIX_V6_LPBIG_OFFBIG
+#elif CONF_IS_DEFINED (_POSIX_V6_LPBIG_OFFBIG)
KNOWN_ABSENT_ENVIRONMENT (V6, POSIX_V6, LPBIG_OFFBIG)
#else
UNKNOWN_ENVIRONMENT (V6, POSIX_V6, LPBIG_OFFBIG)
@@ -116,33 +119,33 @@ END_ENV_GROUP (V6)
START_ENV_GROUP (V5)
-#if _XBS5_ILP32_OFF32 > 0
+#if CONF_IS_DEFINED_SET (_XBS5_ILP32_OFF32)
KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
-#elif defined _XBS5_ILP32_OFF32
+#elif CONF_IS_DEFINED (_XBS5_ILP32_OFF32)
KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
#else
UNKNOWN_ENVIRONMENT (XBS5, XBS5, ILP32_OFF32)
#endif
-#if _XBS5_ILP32_OFFBIG > 0
+#if CONF_IS_DEFINED_SET (_XBS5_ILP32_OFFBIG)
KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
-#elif defined _XBS5_ILP32_OFFBIG
+#elif CONF_IS_DEFINED (_XBS5_ILP32_OFFBIG)
KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
#else
UNKNOWN_ENVIRONMENT (XBS5, XBS5, ILP32_OFFBIG)
#endif
-#if _XBS5_LP64_OFF64 > 0
+#if CONF_IS_DEFINED_SET (_XBS5_LP64_OFF64)
KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
-#elif defined _XBS5_LP64_OFF64
+#elif CONF_IS_DEFINED (_XBS5_LP64_OFF64)
KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
#else
UNKNOWN_ENVIRONMENT (XBS5, XBS5, LP64_OFF64)
#endif
-#if _XBS5_LPBIG_OFFBIG > 0
+#if CONF_IS_DEFINED_SET (_XBS5_LPBIG_OFFBIG)
KNOWN_PRESENT_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
-#elif defined _XBS5_LPBIG_OFFBIG
+#elif CONF_IS_DEFINED (_XBS5_LPBIG_OFFBIG)
KNOWN_ABSENT_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
#else
UNKNOWN_ENVIRONMENT (XBS5, XBS5, LPBIG_OFFBIG)
diff --git a/posix/posix_madvise.c b/posix/posix_madvise.c
index 996e1ddbd6..436676aa73 100644
--- a/posix/posix_madvise.c
+++ b/posix/posix_madvise.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2015 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
diff --git a/posix/pread.c b/posix/pread.c
index 9cf1f62d81..f8ff0fe8b9 100644
--- a/posix/pread.c
+++ b/posix/pread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/pread64.c b/posix/pread64.c
index e73fdab1ba..4e7e2c5d39 100644
--- a/posix/pread64.c
+++ b/posix/pread64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/pwrite.c b/posix/pwrite.c
index e982546f35..9428302156 100644
--- a/posix/pwrite.c
+++ b/posix/pwrite.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/pwrite64.c b/posix/pwrite64.c
index 50eaec83d3..121713a7de 100644
--- a/posix/pwrite64.c
+++ b/posix/pwrite64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/re_comp.h b/posix/re_comp.h
index 7c6a7240a6..b9b9d798e3 100644
--- a/posix/re_comp.h
+++ b/posix/re_comp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 921d0f49a3..bf8aa1604c 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -19,6 +19,10 @@
#include <stdint.h>
+#ifdef _LIBC
+# include <locale/weight.h>
+#endif
+
static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
size_t length, reg_syntax_t syntax);
static void re_compile_fastmap_iter (regex_t *bufp,
@@ -208,7 +212,7 @@ const size_t __re_error_msgid_idx[] attribute_hidden =
compiles PATTERN (of length LENGTH) and puts the result in BUFP.
Returns 0 if the pattern was valid, otherwise an error string.
- Assumes the `allocated' (and perhaps `buffer') and `translate' fields
+ Assumes the 'allocated' (and perhaps 'buffer') and 'translate' fields
are set in BUFP on entry. */
const char *
@@ -237,7 +241,7 @@ re_compile_pattern (pattern, length, bufp)
weak_alias (__re_compile_pattern, re_compile_pattern)
#endif
-/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
+/* Set by 're_set_syntax' to the current regexp syntax to recognize. Can
also be assigned to arbitrarily: each pattern buffer stores its own
syntax, so it can be changed between regex compilations. */
/* This has no initializer because initialized variables in Emacs
@@ -288,8 +292,8 @@ weak_alias (__re_compile_fastmap, re_compile_fastmap)
#endif
static inline void
-__attribute ((always_inline))
-re_set_fastmap (char *fastmap, int icase, int ch)
+__attribute__ ((always_inline))
+re_set_fastmap (char *fastmap, bool icase, int ch)
{
fastmap[ch] = 1;
if (icase)
@@ -330,7 +334,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
memset (&state, '\0', sizeof (state));
if (__mbrtowc (&wc, (const char *) buf, p - buf,
&state) == p - buf
- && (__wcrtomb ((char *) buf, towlower (wc), &state)
+ && (__wcrtomb ((char *) buf, __towlower (wc), &state)
!= (size_t) -1))
re_set_fastmap (fastmap, 0, buf[0]);
}
@@ -406,7 +410,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
{
- if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
+ if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state)
!= (size_t) -1)
re_set_fastmap (fastmap, false, *(unsigned char *) buf);
}
@@ -434,15 +438,15 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
PREG is a regex_t *. We do not expect any fields to be initialized,
since POSIX says we shouldn't. Thus, we set
- `buffer' to the compiled pattern;
- `used' to the length of the compiled pattern;
- `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
+ 'buffer' to the compiled pattern;
+ 'used' to the length of the compiled pattern;
+ 'syntax' to RE_SYNTAX_POSIX_EXTENDED if the
REG_EXTENDED bit in CFLAGS is set; otherwise, to
RE_SYNTAX_POSIX_BASIC;
- `newline_anchor' to REG_NEWLINE being set in CFLAGS;
- `fastmap' to an allocated space for the fastmap;
- `fastmap_accurate' to zero;
- `re_nsub' to the number of subexpressions in PATTERN.
+ 'newline_anchor' to REG_NEWLINE being set in CFLAGS;
+ 'fastmap' to an allocated space for the fastmap;
+ 'fastmap_accurate' to zero;
+ 're_nsub' to the number of subexpressions in PATTERN.
PATTERN is the address of the pattern string.
@@ -699,7 +703,7 @@ re_comp (s)
+ __re_error_msgid_idx[(int) REG_ESPACE]);
}
- /* Since `re_exec' always passes NULL for the `regs' argument, we
+ /* Since 're_exec' always passes NULL for the 'regs' argument, we
don't need to initialize the pattern buffer fields which affect it. */
/* Match anchors at newlines. */
@@ -1507,7 +1511,7 @@ duplicate_node_closure (re_dfa_t *dfa, int top_org_node, int top_clone_node,
destination. */
org_dest = dfa->edests[org_node].elems[0];
re_node_set_empty (dfa->edests + clone_node);
- /* If the node is root_node itself, it means the epsilon clsoure
+ /* If the node is root_node itself, it means the epsilon closure
has a loop. Then tie it to the destination of the root_node. */
if (org_node == root_node && clone_node != org_node)
{
@@ -1516,7 +1520,7 @@ duplicate_node_closure (re_dfa_t *dfa, int top_org_node, int top_clone_node,
return REG_ESPACE;
break;
}
- /* In case of the node has another constraint, add it. */
+ /* In case the node has another constraint, append it. */
constraint |= dfa->nodes[org_node].constraint;
clone_dest = duplicate_node (dfa, org_dest, constraint);
if (BE (clone_dest == -1, 0))
@@ -1659,7 +1663,7 @@ calc_eclosure (re_dfa_t *dfa)
/* If we have already calculated, skip it. */
if (dfa->eclosures[node_idx].nelem != 0)
continue;
- /* Calculate epsilon closure of `node_idx'. */
+ /* Calculate epsilon closure of 'node_idx'. */
err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, 1);
if (BE (err != REG_NOERROR, 0))
return err;
@@ -1726,11 +1730,11 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
}
else
eclosure_elem = dfa->eclosures[edest];
- /* Merge the epsilon closure of `edest'. */
+ /* Merge the epsilon closure of 'edest'. */
err = re_node_set_merge (&eclosure, &eclosure_elem);
if (BE (err != REG_NOERROR, 0))
return err;
- /* If the epsilon closure of `edest' is incomplete,
+ /* If the epsilon closure of 'edest' is incomplete,
the epsilon closure of this node is also incomplete. */
if (dfa->eclosures[edest].nelem == 0)
{
@@ -2092,7 +2096,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
/* Entry point of the parser.
Parse the regular expression REGEXP and return the structure tree.
- If an error is occured, ERR is set by error code, and return NULL.
+ If an error occurs, ERR is set by error code, and return NULL.
This function build the following tree, from regular expression <reg_exp>:
CAT
/ \
@@ -2134,7 +2138,7 @@ parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
/ \
<branch1> <branch2>
- ALT means alternative, which represents the operator `|'. */
+ ALT means alternative, which represents the operator '|'. */
static bin_tree_t *
parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
@@ -2154,7 +2158,11 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
branch = parse_branch (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && branch == NULL, 0))
- return NULL;
+ {
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
+ return NULL;
+ }
}
else
branch = NULL;
@@ -2415,14 +2423,21 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS
|| token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM)
{
- tree = parse_dup_op (tree, regexp, dfa, token, syntax, err);
- if (BE (*err != REG_NOERROR && tree == NULL, 0))
- return NULL;
+ bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, syntax, err);
+ if (BE (*err != REG_NOERROR && dup_tree == NULL, 0))
+ {
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
+ return NULL;
+ }
+ tree = dup_tree;
/* In BRE consecutive duplications are not allowed. */
if ((syntax & RE_CONTEXT_INVALID_DUP)
&& (token->type == OP_DUP_ASTERISK
|| token->type == OP_OPEN_DUP_NUM))
{
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
*err = REG_BADRPT;
return NULL;
}
@@ -2571,6 +2586,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
/* Duplicate ELEM before it is marked optional. */
elem = duplicate_tree (elem, dfa);
+ if (BE (elem == NULL, 0))
+ goto parse_dup_op_espace;
old_tree = tree;
}
else
@@ -2617,7 +2634,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
Build the range expression which starts from START_ELEM, and ends
at END_ELEM. The result are written to MBCSET and SBCSET.
RANGE_ALLOC is the allocated size of mbcset->range_starts, and
- mbcset->range_ends, is a pointer argument sinse we may
+ mbcset->range_ends, is a pointer argument since we may
update it. */
static reg_errcode_t
@@ -2666,7 +2683,7 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
return REG_ECOLLATE;
cmp_buf[0] = start_wc;
cmp_buf[4] = end_wc;
- if (wcscoll (cmp_buf, cmp_buf + 4) > 0)
+ if (__wcscoll (cmp_buf, cmp_buf + 4) > 0)
return REG_ERANGE;
/* Got valid collation sequence values, add them as a new entry.
@@ -2708,8 +2725,8 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
for (wc = 0; wc < SBC_MAX; ++wc)
{
cmp_buf[2] = wc;
- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0
- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
+ if (__wcscoll (cmp_buf, cmp_buf + 2) <= 0
+ && __wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
bitset_set (sbcset, wc);
}
}
@@ -2776,13 +2793,13 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
const int32_t *symb_table;
const unsigned char *extra;
- /* Local function for parse_bracket_exp used in _LIBC environement.
- Seek the collating symbol entry correspondings to NAME.
+ /* Local function for parse_bracket_exp used in _LIBC environment.
+ Seek the collating symbol entry corresponding to NAME.
Return the index of the symbol in the SYMB_TABLE,
or -1 if not found. */
auto inline int32_t
- __attribute ((always_inline))
+ __attribute__ ((always_inline))
seek_collating_symbol_entry (const unsigned char *name, size_t name_len)
{
int32_t elem;
@@ -2808,7 +2825,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
Return the value if succeeded, UINT_MAX otherwise. */
auto inline unsigned int
- __attribute ((always_inline))
+ __attribute__ ((always_inline))
lookup_collation_sequence_value (bracket_elem_t *br_elem)
{
if (br_elem->type == SB_CHAR)
@@ -2868,15 +2885,15 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
return UINT_MAX;
}
- /* Local function for parse_bracket_exp used in _LIBC environement.
+ /* Local function for parse_bracket_exp used in _LIBC environment.
Build the range expression which starts from START_ELEM, and ends
at END_ELEM. The result are written to MBCSET and SBCSET.
RANGE_ALLOC is the allocated size of mbcset->range_starts, and
- mbcset->range_ends, is a pointer argument sinse we may
+ mbcset->range_ends, is a pointer argument since we may
update it. */
auto inline reg_errcode_t
- __attribute ((always_inline))
+ __attribute__ ((always_inline))
build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc,
bracket_elem_t *start_elem, bracket_elem_t *end_elem)
{
@@ -2949,14 +2966,14 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
return REG_NOERROR;
}
- /* Local function for parse_bracket_exp used in _LIBC environement.
+ /* Local function for parse_bracket_exp used in _LIBC environment.
Build the collating element which is represented by NAME.
The result are written to MBCSET and SBCSET.
COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
- pointer argument sinse we may update it. */
+ pointer argument since we may update it. */
auto inline reg_errcode_t
- __attribute ((always_inline))
+ __attribute__ ((always_inline))
build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
int *coll_sym_alloc, const unsigned char *name)
{
@@ -3097,6 +3114,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
re_token_t token2;
start_elem.opr.name = start_name_buf;
+ start_elem.type = COLL_SYM;
ret = parse_bracket_element (&start_elem, regexp, token, token_len, dfa,
syntax, first_round);
if (BE (ret != REG_NOERROR, 0))
@@ -3140,6 +3158,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
if (is_range_exp == 1)
{
end_elem.opr.name = end_name_buf;
+ end_elem.type = COLL_SYM;
ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2,
dfa, syntax, 1);
if (BE (ret != REG_NOERROR, 0))
@@ -3393,7 +3412,7 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
Build the equivalence class which is represented by NAME.
The result are written to MBCSET and SBCSET.
EQUIV_CLASS_ALLOC is the allocated size of mbcset->equiv_classes,
- is a pointer argument sinse we may update it. */
+ is a pointer argument since we may update it. */
static reg_errcode_t
#ifdef RE_ENABLE_I18N
@@ -3413,8 +3432,6 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
int32_t idx1, idx2;
unsigned int ch;
size_t len;
- /* This #include defines a local function! */
-# include <locale/weight.h>
/* Calculate the index for equivalence class. */
cp = name;
table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
@@ -3424,7 +3441,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
_NL_COLLATE_EXTRAMB);
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_INDIRECTMB);
- idx1 = findidx (&cp, -1);
+ idx1 = findidx (table, indirect, extra, &cp, -1);
if (BE (idx1 == 0 || *cp != '\0', 0))
/* This isn't a valid character. */
return REG_ECOLLATE;
@@ -3435,7 +3452,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
{
char_buf[0] = ch;
cp = char_buf;
- idx2 = findidx (&cp, 1);
+ idx2 = findidx (table, indirect, extra, &cp, 1);
/*
idx2 = table[ch];
*/
@@ -3488,7 +3505,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
Build the character class which is represented by NAME.
The result are written to MBCSET and SBCSET.
CHAR_CLASS_ALLOC is the allocated size of mbcset->char_classes,
- is a pointer argument sinse we may update it. */
+ is a pointer argument since we may update it. */
static reg_errcode_t
#ifdef RE_ENABLE_I18N
diff --git a/posix/regex.c b/posix/regex.c
index c47fa0d6f6..1e857369a5 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
diff --git a/posix/regex.h b/posix/regex.h
index bb18d64a85..5b1981e170 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -1,6 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library.
- Copyright (C) 1985, 1989-2014 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1989-2015 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
@@ -529,7 +529,7 @@ extern void re_set_registers (struct re_pattern_buffer *__buffer,
regoff_t *__starts, regoff_t *__ends);
#endif /* Use GNU */
-#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD)
+#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC)
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index 7eebf46924..8597d7ed9a 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -312,12 +312,12 @@ build_wcs_upper_buffer (re_string_t *pstr)
if (BE (mbclen + 2 > 2, 1))
{
wchar_t wcu = wc;
- if (iswlower (wc))
+ if (__iswlower (wc))
{
size_t mbcdlen;
- wcu = towupper (wc);
- mbcdlen = wcrtomb (buf, wcu, &prev_st);
+ wcu = __towupper (wc);
+ mbcdlen = __wcrtomb (buf, wcu, &prev_st);
if (BE (mbclen == mbcdlen, 1))
memcpy (pstr->mbs + byte_idx, buf, mbclen);
else
@@ -382,12 +382,12 @@ build_wcs_upper_buffer (re_string_t *pstr)
if (BE (mbclen + 2 > 2, 1))
{
wchar_t wcu = wc;
- if (iswlower (wc))
+ if (__iswlower (wc))
{
size_t mbcdlen;
- wcu = towupper (wc);
- mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st);
+ wcu = __towupper (wc);
+ mbcdlen = __wcrtomb ((char *) buf, wcu, &prev_st);
if (BE (mbclen == mbcdlen, 1))
memcpy (pstr->mbs + byte_idx, buf, mbclen);
else if (mbcdlen != (size_t) -1)
@@ -679,7 +679,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
pstr->valid_len - offset);
pstr->valid_len -= offset;
pstr->valid_raw_len -= offset;
-#if DEBUG
+#if defined DEBUG && DEBUG
assert (pstr->valid_len > 0);
#endif
}
@@ -936,7 +936,7 @@ re_string_context_at (const re_string_t *input, int idx, int eflags)
int wc_idx = idx;
while(input->wcs[wc_idx] == WEOF)
{
-#ifdef DEBUG
+#if defined DEBUG && DEBUG
/* It must not happen. */
assert (wc_idx >= 0);
#endif
diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index 75c390f8c8..154e96999d 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -62,7 +62,6 @@
# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
# define _RE_DEFINE_LOCALE_FUNCTIONS 1
# include <locale/localeinfo.h>
-# include <locale/elem-hash.h>
# include <locale/coll-lookup.h>
# endif
#endif
@@ -90,7 +89,7 @@
# define SIZE_MAX ((size_t) -1)
#endif
-#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) || _LIBC
+#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE) || _LIBC
# define RE_ENABLE_I18N
#endif
@@ -382,7 +381,7 @@ typedef struct re_dfa_t re_dfa_t;
# endif
#endif
-#ifndef NOT_IN_libc
+#if IS_IN (libc)
static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
int new_buf_len)
internal_function;
@@ -472,7 +471,7 @@ typedef struct bin_tree_storage_t bin_tree_storage_t;
#define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
#define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
-#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_')
+#define IS_WIDE_WORD_CHAR(ch) (__iswalnum (ch) || (ch) == L'_')
#define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
#define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
@@ -732,7 +731,11 @@ re_string_wchar_at (const re_string_t *pstr, int idx)
return (wint_t) pstr->wcs[idx];
}
-# ifndef NOT_IN_libc
+# if IS_IN (libc)
+# ifdef _LIBC
+# include <locale/weight.h>
+# endif
+
static int
internal_function __attribute__ ((pure, unused))
re_string_elem_size_at (const re_string_t *pstr, int idx)
@@ -740,7 +743,6 @@ re_string_elem_size_at (const re_string_t *pstr, int idx)
# ifdef _LIBC
const unsigned char *p, *extra;
const int32_t *table, *indirect;
-# include <locale/weight.h>
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
if (nrules != 0)
@@ -751,7 +753,7 @@ re_string_elem_size_at (const re_string_t *pstr, int idx)
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_INDIRECTMB);
p = pstr->mbs + idx;
- findidx (&p, pstr->len - idx);
+ findidx (table, indirect, extra, &p, pstr->len - idx);
return p - pstr->mbs - idx;
}
else
diff --git a/posix/regexbug1.c b/posix/regexbug1.c
index 28640968d0..17643e7e4d 100644
--- a/posix/regexbug1.c
+++ b/posix/regexbug1.c
@@ -18,7 +18,7 @@ main (void)
{
char buf[100];
regerror (reerr, &re, buf, sizeof buf);
- error (EXIT_FAILURE, 0, buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
if (regexec (&re, "002", 2, ma, 0) != 0)
@@ -35,7 +35,7 @@ main (void)
{
char buf[100];
regerror (reerr, &re, buf, sizeof buf);
- error (EXIT_FAILURE, 0, buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
if (regexec (&re, "002", 2, ma, 0) != 0)
diff --git a/posix/regexec.c b/posix/regexec.c
index 7032da75aa..70cd6064dd 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -3749,6 +3749,10 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
one collating element like '.', '[a-z]', opposite to the other nodes
can only accept one byte. */
+# ifdef _LIBC
+# include <locale/weight.h>
+# endif
+
static int
internal_function
check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
@@ -3868,8 +3872,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
const int32_t *table, *indirect;
const unsigned char *weights, *extra;
const char *collseqwc;
- /* This #include defines a local function! */
-# include <locale/weight.h>
/* match with collating_symbol? */
if (cset->ncoll_syms)
@@ -3925,7 +3927,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
indirect = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
- int32_t idx = findidx (&cp, elem_len);
+ int32_t idx = findidx (table, indirect, extra, &cp, elem_len);
if (idx > 0)
for (i = 0; i < cset->nequiv_classes; ++i)
{
@@ -3966,8 +3968,8 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
{
cmp_buf[0] = cset->range_starts[i];
cmp_buf[4] = cset->range_ends[i];
- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0
- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
+ if (__wcscoll (cmp_buf, cmp_buf + 2) <= 0
+ && __wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0)
{
match_len = char_len;
goto check_node_accept_bytes_match;
diff --git a/posix/runptests.c b/posix/runptests.c
index 76b21e89d5..0494fa7d47 100644
--- a/posix/runptests.c
+++ b/posix/runptests.c
@@ -1,5 +1,5 @@
/* POSIX regex testsuite from IEEE 2003.2.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/posix/sched.h b/posix/sched.h
index f7da2559f9..8069ec1543 100644
--- a/posix/sched.h
+++ b/posix/sched.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,8 +27,10 @@
#define __need_size_t
#include <stddef.h>
-#define __need_time_t
-#define __need_timespec
+#ifdef __USE_XOPEN2K
+# define __need_time_t
+# define __need_timespec
+#endif
#include <time.h>
#ifndef __pid_t_defined
diff --git a/posix/sched_cpualloc.c b/posix/sched_cpualloc.c
index 8396d268ce..8cc817be6a 100644
--- a/posix/sched_cpualloc.c
+++ b/posix/sched_cpualloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2015 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
diff --git a/posix/sched_cpucount.c b/posix/sched_cpucount.c
index fd11f0b256..1245a2d4f8 100644
--- a/posix/sched_cpucount.c
+++ b/posix/sched_cpucount.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2015 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
diff --git a/posix/sched_cpufree.c b/posix/sched_cpufree.c
index 9e9d43a15e..de47821d65 100644
--- a/posix/sched_cpufree.c
+++ b/posix/sched_cpufree.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2015 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
diff --git a/posix/sched_getaffinity.c b/posix/sched_getaffinity.c
index 665b5c8295..2d8f838ae8 100644
--- a/posix/sched_getaffinity.c
+++ b/posix/sched_getaffinity.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2015 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
diff --git a/posix/sched_getp.c b/posix/sched_getp.c
index 0a7fd29c15..16ced84b91 100644
--- a/posix/sched_getp.c
+++ b/posix/sched_getp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/sched_gets.c b/posix/sched_gets.c
index dbc37fdf7a..55a45bb26e 100644
--- a/posix/sched_gets.c
+++ b/posix/sched_gets.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/sched_primax.c b/posix/sched_primax.c
index 0730cb784c..21594a3cc0 100644
--- a/posix/sched_primax.c
+++ b/posix/sched_primax.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/sched_primin.c b/posix/sched_primin.c
index ce3e2ffb06..0c153edab1 100644
--- a/posix/sched_primin.c
+++ b/posix/sched_primin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/sched_rr_gi.c b/posix/sched_rr_gi.c
index c2a831b564..e0aa7d66eb 100644
--- a/posix/sched_rr_gi.c
+++ b/posix/sched_rr_gi.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/sched_setaffinity.c b/posix/sched_setaffinity.c
index 687280b00f..579fc390e5 100644
--- a/posix/sched_setaffinity.c
+++ b/posix/sched_setaffinity.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2015 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
diff --git a/posix/sched_setp.c b/posix/sched_setp.c
index b7fe8e1e14..b16aed07c2 100644
--- a/posix/sched_setp.c
+++ b/posix/sched_setp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/sched_sets.c b/posix/sched_sets.c
index eb36c5b139..1ac57db3d0 100644
--- a/posix/sched_sets.c
+++ b/posix/sched_sets.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/sched_yield.c b/posix/sched_yield.c
index 682ef6cb80..944b07e534 100644
--- a/posix/sched_yield.c
+++ b/posix/sched_yield.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/setgid.c b/posix/setgid.c
index ad9f71cca5..4a37cc77d8 100644
--- a/posix/setgid.c
+++ b/posix/setgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/setpgid.c b/posix/setpgid.c
index f977577e61..7289148d74 100644
--- a/posix/setpgid.c
+++ b/posix/setpgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/setpgrp.c b/posix/setpgrp.c
index 154777c411..bc1fa02413 100644
--- a/posix/setpgrp.c
+++ b/posix/setpgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2015 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
diff --git a/posix/setresgid.c b/posix/setresgid.c
index 7cf13e515a..756ec76c90 100644
--- a/posix/setresgid.c
+++ b/posix/setresgid.c
@@ -1,5 +1,5 @@
/* setresgid -- set real group ID, effective group ID, and saved-set group ID
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 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
diff --git a/posix/setresuid.c b/posix/setresuid.c
index da1d786d31..5ed715fb52 100644
--- a/posix/setresuid.c
+++ b/posix/setresuid.c
@@ -1,5 +1,5 @@
/* setresuid -- set real user ID, effective user ID, and saved-set user ID
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 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
diff --git a/posix/setsid.c b/posix/setsid.c
index 0b93f7bb07..06b5b8bd22 100644
--- a/posix/setsid.c
+++ b/posix/setsid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/setuid.c b/posix/setuid.c
index 99298fe397..794eb02508 100644
--- a/posix/setuid.c
+++ b/posix/setuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/sleep.c b/posix/sleep.c
index 0d53f07604..0ae79c1c4b 100644
--- a/posix/sleep.c
+++ b/posix/sleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/spawn.c b/posix/spawn.c
index 6dd30c9c32..e295d123fe 100644
--- a/posix/spawn.c
+++ b/posix/spawn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawn.h b/posix/spawn.h
index 82b6761b75..af4a303352 100644
--- a/posix/spawn.h
+++ b/posix/spawn.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX spawn interface.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 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
diff --git a/posix/spawn_faction_addclose.c b/posix/spawn_faction_addclose.c
index ca1c5b2710..2328552c5e 100644
--- a/posix/spawn_faction_addclose.c
+++ b/posix/spawn_faction_addclose.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawn_faction_adddup2.c b/posix/spawn_faction_adddup2.c
index 8c750f0bef..28abf5fd32 100644
--- a/posix/spawn_faction_adddup2.c
+++ b/posix/spawn_faction_adddup2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawn_faction_addopen.c b/posix/spawn_faction_addopen.c
index 47f62425b6..f133300666 100644
--- a/posix/spawn_faction_addopen.c
+++ b/posix/spawn_faction_addopen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
@@ -18,6 +18,8 @@
#include <errno.h>
#include <spawn.h>
#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
#include "spawn_int.h"
@@ -35,17 +37,24 @@ posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *file_actions,
if (fd < 0 || fd >= maxfd)
return EBADF;
+ char *path_copy = strdup (path);
+ if (path_copy == NULL)
+ return ENOMEM;
+
/* Allocate more memory if needed. */
if (file_actions->__used == file_actions->__allocated
&& __posix_spawn_file_actions_realloc (file_actions) != 0)
- /* This can only mean we ran out of memory. */
- return ENOMEM;
+ {
+ /* This can only mean we ran out of memory. */
+ free (path_copy);
+ return ENOMEM;
+ }
/* Add the new value. */
rec = &file_actions->__actions[file_actions->__used];
rec->tag = spawn_do_open;
rec->action.open_action.fd = fd;
- rec->action.open_action.path = path;
+ rec->action.open_action.path = path_copy;
rec->action.open_action.oflag = oflag;
rec->action.open_action.mode = mode;
diff --git a/posix/spawn_faction_destroy.c b/posix/spawn_faction_destroy.c
index 4d165aab01..2bcf06b887 100644
--- a/posix/spawn_faction_destroy.c
+++ b/posix/spawn_faction_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
@@ -18,11 +18,29 @@
#include <spawn.h>
#include <stdlib.h>
-/* Initialize data structure for file attribute for `spawn' call. */
+#include "spawn_int.h"
+
+/* Deallocate the file actions. */
int
posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
{
- /* Free the memory allocated. */
+ /* Free the paths in the open actions. */
+ for (int i = 0; i < file_actions->__used; ++i)
+ {
+ struct __spawn_action *sa = &file_actions->__actions[i];
+ switch (sa->tag)
+ {
+ case spawn_do_open:
+ free (sa->action.open_action.path);
+ break;
+ case spawn_do_close:
+ case spawn_do_dup2:
+ /* No cleanup required. */
+ break;
+ }
+ }
+
+ /* Free the array of actions. */
free (file_actions->__actions);
return 0;
}
diff --git a/posix/spawn_faction_init.c b/posix/spawn_faction_init.c
index 081f781730..1044e66460 100644
--- a/posix/spawn_faction_init.c
+++ b/posix/spawn_faction_init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawn_int.h b/posix/spawn_int.h
index 5609e587e1..861e3b47bb 100644
--- a/posix/spawn_int.h
+++ b/posix/spawn_int.h
@@ -22,7 +22,7 @@ struct __spawn_action
struct
{
int fd;
- const char *path;
+ char *path;
int oflag;
mode_t mode;
} open_action;
diff --git a/posix/spawnattr_destroy.c b/posix/spawnattr_destroy.c
index aae80da00f..602e7b5c2c 100644
--- a/posix/spawnattr_destroy.c
+++ b/posix/spawnattr_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_getdefault.c b/posix/spawnattr_getdefault.c
index cc9f7667f3..1664666550 100644
--- a/posix/spawnattr_getdefault.c
+++ b/posix/spawnattr_getdefault.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_getflags.c b/posix/spawnattr_getflags.c
index ca17d40fe0..ec89c30997 100644
--- a/posix/spawnattr_getflags.c
+++ b/posix/spawnattr_getflags.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_getpgroup.c b/posix/spawnattr_getpgroup.c
index a6c698e487..77148e8cc4 100644
--- a/posix/spawnattr_getpgroup.c
+++ b/posix/spawnattr_getpgroup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_getschedparam.c b/posix/spawnattr_getschedparam.c
index 900beb4567..5eb4145d4b 100644
--- a/posix/spawnattr_getschedparam.c
+++ b/posix/spawnattr_getschedparam.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_getschedpolicy.c b/posix/spawnattr_getschedpolicy.c
index aa57dfdf4e..fb40afbbdc 100644
--- a/posix/spawnattr_getschedpolicy.c
+++ b/posix/spawnattr_getschedpolicy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_getsigmask.c b/posix/spawnattr_getsigmask.c
index 29104b0e8f..eadb4e46cd 100644
--- a/posix/spawnattr_getsigmask.c
+++ b/posix/spawnattr_getsigmask.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_init.c b/posix/spawnattr_init.c
index 647a055b2d..ed8a581010 100644
--- a/posix/spawnattr_init.c
+++ b/posix/spawnattr_init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_setdefault.c b/posix/spawnattr_setdefault.c
index 9ec4752d93..0bf8a3ea97 100644
--- a/posix/spawnattr_setdefault.c
+++ b/posix/spawnattr_setdefault.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_setflags.c b/posix/spawnattr_setflags.c
index 8955de6efb..883c3450f7 100644
--- a/posix/spawnattr_setflags.c
+++ b/posix/spawnattr_setflags.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_setpgroup.c b/posix/spawnattr_setpgroup.c
index a0b4333778..cf4b500ea2 100644
--- a/posix/spawnattr_setpgroup.c
+++ b/posix/spawnattr_setpgroup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_setschedparam.c b/posix/spawnattr_setschedparam.c
index f5453b1b0b..8ac34ce352 100644
--- a/posix/spawnattr_setschedparam.c
+++ b/posix/spawnattr_setschedparam.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_setschedpolicy.c b/posix/spawnattr_setschedpolicy.c
index 88535dd549..859e762abc 100644
--- a/posix/spawnattr_setschedpolicy.c
+++ b/posix/spawnattr_setschedpolicy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawnattr_setsigmask.c b/posix/spawnattr_setsigmask.c
index add9b90eb7..07c9b1cc80 100644
--- a/posix/spawnattr_setsigmask.c
+++ b/posix/spawnattr_setsigmask.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/spawni.c b/posix/spawni.c
index 410f0fbef7..6d40779278 100644
--- a/posix/spawni.c
+++ b/posix/spawni.c
@@ -1,5 +1,5 @@
/* Guts of POSIX spawn interface. Stub version.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 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
diff --git a/posix/spawnp.c b/posix/spawnp.c
index 4be614b977..083fc35126 100644
--- a/posix/spawnp.c
+++ b/posix/spawnp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 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
diff --git a/posix/sys/times.h b/posix/sys/times.h
index 7edead0f06..0af59fcefa 100644
--- a/posix/sys/times.h
+++ b/posix/sys/times.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 0d51ae8a67..bf30873756 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@ __BEGIN_DECLS
#include <bits/types.h>
-#ifdef __USE_BSD
+#ifdef __USE_MISC
# ifndef __u_char_defined
typedef __u_char u_char;
typedef __u_short u_short;
@@ -99,7 +99,7 @@ typedef __pid_t pid_t;
# define __pid_t_defined
#endif
-#if (defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8) \
+#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \
&& !defined __id_t_defined
typedef __id_t id_t;
# define __id_t_defined
@@ -110,7 +110,7 @@ typedef __ssize_t ssize_t;
# define __ssize_t_defined
#endif
-#ifdef __USE_BSD
+#ifdef __USE_MISC
# ifndef __daddr_t_defined
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
@@ -118,7 +118,7 @@ typedef __caddr_t caddr_t;
# endif
#endif
-#if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined
+#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined
typedef __key_t key_t;
# define __key_t_defined
#endif
@@ -211,7 +211,7 @@ typedef int register_t __attribute__ ((__mode__ (__word__)));
#define __BIT_TYPES_DEFINED__ 1
-#ifdef __USE_BSD
+#ifdef __USE_MISC
/* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
# include <endian.h>
@@ -220,7 +220,7 @@ typedef int register_t __attribute__ ((__mode__ (__word__)));
/* BSD defines these symbols, so we follow. */
# include <sys/sysmacros.h>
-#endif /* Use BSD. */
+#endif /* Use misc. */
#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
diff --git a/posix/sys/utsname.h b/posix/sys/utsname.h
index 32e3ba66be..9426f4ad9c 100644
--- a/posix/sys/utsname.h
+++ b/posix/sys/utsname.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -71,7 +71,7 @@ struct utsname
#endif
};
-#ifdef __USE_SVID
+#ifdef __USE_MISC
/* Note that SVID assumes all members have the same size. */
# define SYS_NMLN _UTSNAME_LENGTH
#endif
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index 72983865e5..e5c9f74d6e 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -34,7 +34,7 @@ __BEGIN_DECLS
bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
-# ifdef __USE_BSD
+# ifdef __USE_MISC
/* Lots of hair to allow traditional BSD use of `union wait'
as well as POSIX.1 use of `int' for the status word. */
@@ -65,13 +65,13 @@ typedef union
# define __WAIT_STATUS_DEFN int *
# endif
-# else /* Don't use BSD. */
+# else /* Don't use misc. */
# define __WAIT_INT(status) (status)
# define __WAIT_STATUS int *
# define __WAIT_STATUS_DEFN int *
-# endif /* Use BSD. */
+# endif /* Use misc. */
/* This will define all the `__W*' macros. */
# include <bits/waitstatus.h>
@@ -87,7 +87,7 @@ typedef union
# endif
#endif /* <stdlib.h> not included. */
-#ifdef __USE_BSD
+#ifdef __USE_MISC
# define WCOREFLAG __WCOREFLAG
# define WCOREDUMP(status) __WCOREDUMP (__WAIT_INT (status))
# define W_EXITCODE(ret, sig) __W_EXITCODE (ret, sig)
@@ -95,7 +95,7 @@ typedef union
#endif
/* The following values are used by the `waitid' function. */
-#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
typedef enum
{
P_ALL, /* Wait for any child. */
@@ -112,7 +112,7 @@ typedef enum
__THROW. */
extern __pid_t wait (__WAIT_STATUS __stat_loc);
-#ifdef __USE_BSD
+#ifdef __USE_MISC
/* Special values for the PID argument to `waitpid' and `wait4'. */
# define WAIT_ANY (-1) /* Any process. */
# define WAIT_MYPGRP 0 /* Any process in my process group. */
@@ -135,7 +135,7 @@ extern __pid_t wait (__WAIT_STATUS __stat_loc);
__THROW. */
extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
-#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
# ifndef __id_t_defined
# include <bits/types.h>
typedef __id_t id_t;
@@ -160,7 +160,7 @@ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
int __options);
#endif
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* This being here makes the prototypes valid whether or not
we have already included <sys/resource.h> to define `struct rusage'. */
struct rusage;
@@ -174,11 +174,11 @@ extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options,
struct rusage * __usage) __THROWNL;
#endif
-#ifdef __USE_BSD
+#ifdef __USE_MISC
/* PID is like waitpid. Other args are like wait3. */
extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
struct rusage *__usage) __THROWNL;
-#endif /* Use BSD. */
+#endif /* Use misc. */
__END_DECLS
diff --git a/posix/sysconf.c b/posix/sysconf.c
index 51d2f989d0..0ad15c24ff 100644
--- a/posix/sysconf.c
+++ b/posix/sysconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/tar.h b/posix/tar.h
index 115f4dfeab..d4e7f71ed5 100644
--- a/posix/tar.h
+++ b/posix/tar.h
@@ -1,5 +1,5 @@
/* Extended tar format from POSIX.1.
- Copyright (C) 1992-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by David J. MacKenzie.
@@ -73,7 +73,7 @@
/* The bits in mode: */
#define TSUID 04000
#define TSGID 02000
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || !defined __USE_XOPEN2K
# define TSVTX 01000
#endif
#define TUREAD 00400
diff --git a/posix/times.c b/posix/times.c
index 5bc5daed51..48ee9cdfa1 100644
--- a/posix/times.c
+++ b/posix/times.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/tst-boost.c b/posix/tst-boost.c
index 8850314f35..e3dfd3a4fc 100644
--- a/posix/tst-boost.c
+++ b/posix/tst-boost.c
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/posix/tst-chmod.c b/posix/tst-chmod.c
index fb2ae8bfa5..75ee8540c4 100644
--- a/posix/tst-chmod.c
+++ b/posix/tst-chmod.c
@@ -1,5 +1,5 @@
/* Test for chmod functions.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
diff --git a/posix/tst-dir.c b/posix/tst-dir.c
index 49026f8751..50f75807b7 100644
--- a/posix/tst-dir.c
+++ b/posix/tst-dir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
diff --git a/posix/tst-exec.c b/posix/tst-exec.c
index 51831a9b64..3363a93928 100644
--- a/posix/tst-exec.c
+++ b/posix/tst-exec.c
@@ -1,5 +1,5 @@
/* Tests for exec.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
diff --git a/posix/tst-fnmatch.c b/posix/tst-fnmatch.c
index ff2674cd73..030e56b813 100644
--- a/posix/tst-fnmatch.c
+++ b/posix/tst-fnmatch.c
@@ -1,5 +1,5 @@
/* Tests for fnmatch function.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 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,8 +33,8 @@ static char *flag_output (int flags);
static char *escape (const char *str, size_t *reslenp, char **resbuf);
-int
-main (void)
+static int
+do_test (void)
{
char *linebuf = NULL;
size_t linebuflen = 0;
@@ -388,3 +388,6 @@ escape (const char *str, size_t *reslenp, char **resbufp)
return resbuf;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/tst-fnmatch.input b/posix/tst-fnmatch.input
index 6d3f275b47..02de803eef 100644
--- a/posix/tst-fnmatch.input
+++ b/posix/tst-fnmatch.input
@@ -1,5 +1,5 @@
# Tests for fnmatch.
-# Copyright (C) 2000-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000-2015 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributes by Ulrich Drepper <drepper@redhat.com>.
#
diff --git a/posix/tst-fnmatch3.c b/posix/tst-fnmatch3.c
new file mode 100644
index 0000000000..fdf99342e9
--- /dev/null
+++ b/posix/tst-fnmatch3.c
@@ -0,0 +1,52 @@
+/* Test for fnmatch not reading past the end of the pattern.
+ Copyright (C) 2014-2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fnmatch.h>
+#include <sys/mman.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+do_bz18036 (void)
+{
+ const char p[] = "**(!()";
+ const int pagesize = getpagesize ();
+
+ char *pattern = mmap (0, 2 * pagesize, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ if (pattern == MAP_FAILED) return 1;
+
+ mprotect (pattern + pagesize, pagesize, PROT_NONE);
+ memset (pattern, ' ', pagesize);
+ strcpy (pattern, p);
+
+ return fnmatch (pattern, p, FNM_EXTMATCH);
+}
+
+int
+do_test (void)
+{
+ if (fnmatch ("[[:alpha:]'[:alpha:]\0]", "a", 0) != FNM_NOMATCH)
+ return 1;
+ if (fnmatch ("[a[.\0.]]", "a", 0) != FNM_NOMATCH)
+ return 1;
+ return do_bz18036 ();
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/tst-fork.c b/posix/tst-fork.c
index 41b75b0bf6..0de9e64980 100644
--- a/posix/tst-fork.c
+++ b/posix/tst-fork.c
@@ -1,5 +1,5 @@
/* Tests for fork.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
diff --git a/posix/tst-getaddrinfo.c b/posix/tst-getaddrinfo.c
index e161346a8b..dcafd6bf34 100644
--- a/posix/tst-getaddrinfo.c
+++ b/posix/tst-getaddrinfo.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2015 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
diff --git a/posix/tst-getaddrinfo4.c b/posix/tst-getaddrinfo4.c
index 69019f9206..176a107a43 100644
--- a/posix/tst-getaddrinfo4.c
+++ b/posix/tst-getaddrinfo4.c
@@ -1,5 +1,5 @@
/* Test getaddrinfo return value, [BZ #15339].
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 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
diff --git a/posix/tst-getaddrinfo5.c b/posix/tst-getaddrinfo5.c
new file mode 100644
index 0000000000..d7704d9fc0
--- /dev/null
+++ b/posix/tst-getaddrinfo5.c
@@ -0,0 +1,69 @@
+/* Test host lookup with double dots at the end, [BZ #16469].
+ Copyright (C) 2014-2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <string.h>
+
+static int
+test (void)
+{
+ static char host1[] = "localhost..";
+ static char host2[] = "www.gnu.org..";
+ static char *hosts[] = { host1, host2 };
+ int i;
+ int pass = 0;
+
+ for (i = 0; i < sizeof (hosts) / sizeof (*hosts); i++)
+ {
+ char *host = hosts[i];
+ size_t len = strlen (host);
+ struct addrinfo *ai;
+
+ /* If the name doesn't resolve with a single dot at the
+ end, skip it. */
+ host[len-1] = 0;
+ if (getaddrinfo (host, NULL, NULL, &ai) != 0)
+ {
+ printf ("resolving \"%s\" failed, skipping this hostname\n", host);
+ continue;
+ }
+ printf ("resolving \"%s\" worked, proceeding to test\n", host);
+ freeaddrinfo (ai);
+
+ /* If it resolved with a single dot, check that it doesn't with
+ a second trailing dot. */
+ host[len-1] = '.';
+ if (getaddrinfo (host, NULL, NULL, &ai) == 0)
+ {
+ printf ("resolving \"%s\" worked, test failed\n", host);
+ return 1;
+ }
+ printf ("resolving \"%s\" failed, test passed\n", host);
+ pass = 1;
+ }
+
+ /* We want at least one successful name resolution for the test to
+ succeed. */
+ return pass ? 0 : 2;
+}
+
+#define TEST_FUNCTION test ()
+#define TIMEOUT 10
+#include "../test-skeleton.c"
diff --git a/posix/tst-getconf.sh b/posix/tst-getconf.sh
index 1cbebc5b68..f804457c62 100644
--- a/posix/tst-getconf.sh
+++ b/posix/tst-getconf.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# Test for getconf(1).
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2015 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
@@ -24,12 +24,6 @@ run_getconf=$1; shift
logfile=$common_objpfx/posix/tst-getconf.out
-# Since we use `sort' we must make sure to use the same locale everywhere.
-LC_ALL=C
-export LC_ALL
-LANG=C
-export LANG
-
rm -f $logfile
result=0
while read name; do
diff --git a/posix/tst-getlogin.c b/posix/tst-getlogin.c
deleted file mode 100644
index 1393c3a779..0000000000
--- a/posix/tst-getlogin.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1999-2014 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-
-int
-main (void)
-{
- char *login;
- int errors = 0;
-
- login = getlogin ();
- if (login == NULL)
- puts ("getlogin returned NULL, no further tests");
- else
- {
- char name[1024];
- int ret;
-
- printf ("getlogin returned: `%s'\n", login);
-
- ret = getlogin_r (name, sizeof (name));
- if (ret == 0)
- {
- printf ("getlogin_r returned: `%s'\n", name);
- if (strcmp (name, login) != 0)
- {
- puts ("Error: getlogin and getlogin_r returned different names");
- ++errors;
- }
- }
- else
- {
- printf ("Error: getlogin_r returned: %d (%s)\n",
- ret, strerror (ret));
- ++errors;
- }
- }
-
- return errors != 0;
-}
diff --git a/posix/tst-getopt_long1.c b/posix/tst-getopt_long1.c
index e0ecd12190..3895ebd99b 100644
--- a/posix/tst-getopt_long1.c
+++ b/posix/tst-getopt_long1.c
@@ -39,7 +39,7 @@ do_test (void)
return 1;
}
- char *argv[] = { "program", "--on" };
+ char *argv[] = { (char *) "program", (char *) "--on" };
int argc = 2;
int c = getopt_long (argc, argv, "12345", opts, NULL);
diff --git a/posix/tst-gnuglob.c b/posix/tst-gnuglob.c
index 1c72357de3..d444999691 100644
--- a/posix/tst-gnuglob.c
+++ b/posix/tst-gnuglob.c
@@ -1,6 +1,6 @@
/* Test the GNU extensions in glob which allow the user to provide callbacks
for the filesystem access functions.
- Copyright (C) 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -379,8 +379,8 @@ test_result (const char *fmt, int flags, glob_t *gl, const char *str[])
}
-int
-main (void)
+static int
+do_test (void)
{
glob_t gl;
int errval;
@@ -497,3 +497,6 @@ main (void)
return result;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/tst-mmap.c b/posix/tst-mmap.c
index c03acf5e16..5e52b49e35 100644
--- a/posix/tst-mmap.c
+++ b/posix/tst-mmap.c
@@ -6,8 +6,8 @@
#include <sys/mman.h>
-int
-main (void)
+static int
+do_test (void)
{
int result = 0;
FILE *fp;
@@ -195,3 +195,6 @@ main (void)
/* That's it. */
return result;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/tst-nanosleep.c b/posix/tst-nanosleep.c
index 4874e3b27d..33cb0b4460 100644
--- a/posix/tst-nanosleep.c
+++ b/posix/tst-nanosleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2015 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
diff --git a/posix/tst-nice.c b/posix/tst-nice.c
index 4f172723f3..ac78d6056f 100644
--- a/posix/tst-nice.c
+++ b/posix/tst-nice.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2015 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
diff --git a/posix/tst-pathconf.c b/posix/tst-pathconf.c
index 1130359350..67f0069b65 100644
--- a/posix/tst-pathconf.c
+++ b/posix/tst-pathconf.c
@@ -1,5 +1,5 @@
/* Test that values of pathconf and fpathconf are consistent for a file.
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 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
diff --git a/posix/tst-pcre.c b/posix/tst-pcre.c
index 9d13e67636..f6c0ea4fa1 100644
--- a/posix/tst-pcre.c
+++ b/posix/tst-pcre.c
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/posix/tst-preadwrite.c b/posix/tst-preadwrite.c
index 20059b8415..a84418155d 100644
--- a/posix/tst-preadwrite.c
+++ b/posix/tst-preadwrite.c
@@ -1,5 +1,5 @@
/* Tests for pread and pwrite.
- Copyright (C) 1998-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/posix/tst-preadwrite64.c b/posix/tst-preadwrite64.c
index b146a6920f..6c8295e611 100644
--- a/posix/tst-preadwrite64.c
+++ b/posix/tst-preadwrite64.c
@@ -1,5 +1,5 @@
/* Tests for pread64 and pwrite64.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/posix/tst-regex.c b/posix/tst-regex.c
index 7df0bd1d38..715137bbc4 100644
--- a/posix/tst-regex.c
+++ b/posix/tst-regex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2015 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
@@ -274,8 +274,8 @@ run_test (const char *expr, const char *mem, size_t memlen, int icase,
finish.tv_sec -= start.tv_sec;
}
- printf ("elapsed time: %ld.%09ld sec\n",
- finish.tv_sec, finish.tv_nsec);
+ printf ("elapsed time: %jd.%09jd sec\n",
+ (intmax_t) finish.tv_sec, (intmax_t) finish.tv_nsec);
}
}
@@ -327,8 +327,8 @@ run_test (const char *expr, const char *mem, size_t memlen, int icase,
mintime = finish;
}
}
- printf ("elapsed time: %ld.%09ld sec\n",
- mintime.tv_sec, mintime.tv_nsec);
+ printf ("elapsed time: %jd.%09jd sec\n",
+ (intmax_t) mintime.tv_sec, (intmax_t) mintime.tv_nsec);
}
#endif
@@ -420,8 +420,8 @@ run_test_backwards (const char *expr, const char *mem, size_t memlen,
finish.tv_sec -= start.tv_sec;
}
- printf ("elapsed time: %ld.%09ld sec\n",
- finish.tv_sec, finish.tv_nsec);
+ printf ("elapsed time: %jd.%09jd sec\n",
+ (intmax_t) finish.tv_sec, (intmax_t) finish.tv_nsec);
}
}
@@ -489,8 +489,8 @@ run_test_backwards (const char *expr, const char *mem, size_t memlen,
mintime = finish;
}
}
- printf ("elapsed time: %ld.%09ld sec\n",
- mintime.tv_sec, mintime.tv_nsec);
+ printf ("elapsed time: %jd.%09jd sec\n",
+ (intmax_t) mintime.tv_sec, (intmax_t) mintime.tv_nsec);
}
#endif
diff --git a/posix/tst-regexloc.c b/posix/tst-regexloc.c
index 43a073f23a..38bf87abbf 100644
--- a/posix/tst-regexloc.c
+++ b/posix/tst-regexloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2015 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
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
index fcf8a8cd60..ee9281394b 100644
--- a/posix/tst-rfc3484-2.c
+++ b/posix/tst-rfc3484-2.c
@@ -10,6 +10,7 @@
#define __inet_aton inet_aton
#define __gethostbyaddr_r gethostbyaddr_r
#define __gethostbyname2_r gethostbyname2_r
+#define __qsort_r qsort_r
void
attribute_hidden
diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c
index 86d59be1ab..c987366e4e 100644
--- a/posix/tst-rfc3484-3.c
+++ b/posix/tst-rfc3484-3.c
@@ -10,6 +10,7 @@
#define __inet_aton inet_aton
#define __gethostbyaddr_r gethostbyaddr_r
#define __gethostbyname2_r gethostbyname2_r
+#define __qsort_r qsort_r
void
attribute_hidden
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
index 2726fa0ad9..73c4dffcf5 100644
--- a/posix/tst-rfc3484.c
+++ b/posix/tst-rfc3484.c
@@ -10,6 +10,7 @@
#define __inet_aton inet_aton
#define __gethostbyaddr_r gethostbyaddr_r
#define __gethostbyname2_r gethostbyname2_r
+#define __qsort_r qsort_r
void
attribute_hidden
diff --git a/posix/tst-rxspencer-no-utf8.c b/posix/tst-rxspencer-no-utf8.c
new file mode 100644
index 0000000000..62d4c7dd4c
--- /dev/null
+++ b/posix/tst-rxspencer-no-utf8.c
@@ -0,0 +1 @@
+#include "tst-rxspencer.c"
diff --git a/posix/tst-rxspencer.c b/posix/tst-rxspencer.c
index 5f59cd5936..cef1eb9313 100644
--- a/posix/tst-rxspencer.c
+++ b/posix/tst-rxspencer.c
@@ -1,5 +1,5 @@
/* Regular expression tests.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/posix/tst-spawn.c b/posix/tst-spawn.c
index 84cecf2945..3230ae11fa 100644
--- a/posix/tst-spawn.c
+++ b/posix/tst-spawn.c
@@ -1,5 +1,5 @@
/* Tests for spawn.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
@@ -168,6 +168,7 @@ do_test (int argc, char *argv[])
char fd2name[18];
char fd3name[18];
char fd4name[18];
+ char *name3_copy;
char *spargv[12];
int i;
@@ -222,9 +223,15 @@ do_test (int argc, char *argv[])
if (posix_spawn_file_actions_addclose (&actions, fd1) != 0)
error (EXIT_FAILURE, errno, "posix_spawn_file_actions_addclose");
/* We want to open the third file. */
- if (posix_spawn_file_actions_addopen (&actions, fd3, name3,
+ name3_copy = strdup (name3);
+ if (name3_copy == NULL)
+ error (EXIT_FAILURE, errno, "strdup");
+ if (posix_spawn_file_actions_addopen (&actions, fd3, name3_copy,
O_RDONLY, 0666) != 0)
error (EXIT_FAILURE, errno, "posix_spawn_file_actions_addopen");
+ /* Overwrite the name to check that a copy has been made. */
+ memset (name3_copy, 'X', strlen (name3_copy));
+
/* We dup the second descriptor. */
fd4 = MAX (2, MAX (fd1, MAX (fd2, fd3))) + 1;
if (posix_spawn_file_actions_adddup2 (&actions, fd2, fd4) != 0)
@@ -253,6 +260,7 @@ do_test (int argc, char *argv[])
/* Cleanup. */
if (posix_spawn_file_actions_destroy (&actions) != 0)
error (EXIT_FAILURE, errno, "posix_spawn_file_actions_destroy");
+ free (name3_copy);
/* Wait for the child. */
if (waitpid (pid, &status, 0) != pid)
diff --git a/posix/tst-truncate.c b/posix/tst-truncate.c
index 5d43b8dc4d..feb43b1d11 100644
--- a/posix/tst-truncate.c
+++ b/posix/tst-truncate.c
@@ -1,5 +1,5 @@
/* Tests for ftruncate and truncate.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
diff --git a/posix/tst-truncate64.c b/posix/tst-truncate64.c
index 16cce45dce..5965d56fcd 100644
--- a/posix/tst-truncate64.c
+++ b/posix/tst-truncate64.c
@@ -1,5 +1,5 @@
/* Tests for ftruncate64 and truncate64.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
diff --git a/posix/tst-vfork1.c b/posix/tst-vfork1.c
index e25cf1fe2d..7aa33a3954 100644
--- a/posix/tst-vfork1.c
+++ b/posix/tst-vfork1.c
@@ -1,5 +1,5 @@
/* Test for vfork functions.
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
diff --git a/posix/tst-vfork2.c b/posix/tst-vfork2.c
index f124262d85..05060c8cc4 100644
--- a/posix/tst-vfork2.c
+++ b/posix/tst-vfork2.c
@@ -1,5 +1,5 @@
/* Test for vfork functions.
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
diff --git a/posix/tst-vfork3.c b/posix/tst-vfork3.c
index 756901e032..c3885da03e 100644
--- a/posix/tst-vfork3.c
+++ b/posix/tst-vfork3.c
@@ -1,5 +1,5 @@
/* Test for vfork functions.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
diff --git a/posix/tst-waitid.c b/posix/tst-waitid.c
index 096f64c93f..f24bd72a31 100644
--- a/posix/tst-waitid.c
+++ b/posix/tst-waitid.c
@@ -1,5 +1,5 @@
/* Tests for waitid.
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 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
diff --git a/posix/uname-values.h b/posix/uname-values.h
new file mode 100644
index 0000000000..1e0111848a
--- /dev/null
+++ b/posix/uname-values.h
@@ -0,0 +1,28 @@
+/* Constant values for the uname function to return. Generic version.
+ Copyright (C) 2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This file exists so that it can be replaced by sysdeps variants.
+ It must define these macros with string values:
+ UNAME_SYSNAME
+ UNAME_RELEASE
+ UNAME_VERSION
+ UNAME_MACHINE
+ If there is no sysdeps file, this file will just proxy to the file
+ created by posix/Makefile. */
+
+#include <config-name.h>
diff --git a/posix/uname.c b/posix/uname.c
index e58f230620..072e868151 100644
--- a/posix/uname.c
+++ b/posix/uname.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* uname -- Report basic information about the system. Generic version.
+ Copyright (C) 1991-2015 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
@@ -20,8 +21,8 @@
#include <sys/utsname.h>
#include <unistd.h>
-/* This file is created by the configuration process, and defines UNAME_*. */
-#include <config-name.h>
+/* This file defines UNAME_* to string constants. */
+#include <uname-values.h>
/* Put information about the system in NAME. */
int
diff --git a/posix/unistd.h b/posix/unistd.h
index 64734b0f9b..1b52930225 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -66,6 +66,9 @@ __BEGIN_DECLS
/* The utilities on GNU systems also correspond to this version. */
#define _POSIX2_VERSION __POSIX2_THIS_VERSION
+/* This symbol was required until the 2001 edition of POSIX. */
+#define _POSIX2_C_VERSION __POSIX2_THIS_VERSION
+
/* If defined, the implementation supports the
C Language Bindings Option. */
#define _POSIX2_C_BIND __POSIX2_THIS_VERSION
@@ -262,14 +265,14 @@ typedef __pid_t pid_t;
# endif
#endif /* X/Open */
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __intptr_t_defined
typedef __intptr_t intptr_t;
# define __intptr_t_defined
# endif
#endif
-#if defined __USE_BSD || defined __USE_XOPEN
+#if defined __USE_MISC || defined __USE_XOPEN
# ifndef __socklen_t_defined
typedef __socklen_t socklen_t;
# define __socklen_t_defined
@@ -317,7 +320,7 @@ extern int faccessat (int __fd, const char *__file, int __type, int __flag)
# endif
#endif
-#if defined __USE_BSD && !defined L_SET
+#if defined __USE_MISC && !defined L_SET
/* Old BSD names for the same constants; just for compatibility. */
# define L_SET SEEK_SET
# define L_INCR SEEK_CUR
@@ -444,7 +447,7 @@ extern unsigned int alarm (unsigned int __seconds) __THROW;
extern unsigned int sleep (unsigned int __seconds);
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
- || defined __USE_BSD
+ || defined __USE_MISC
/* Set an alarm to go off (generating a SIGALRM signal) in VALUE
microseconds. If INTERVAL is nonzero, when the alarm goes off, the
timer is reset to go off every INTERVAL microseconds thereafter.
@@ -473,7 +476,7 @@ extern int pause (void);
extern int chown (const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the owner and group of the file that FD is open on. */
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;
@@ -483,7 +486,7 @@ extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;
extern int lchown (const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;
-#endif /* Use BSD || X/Open Unix. */
+#endif /* Use X/Open Unix. */
#ifdef __USE_ATFILE
/* Change the owner and group of FILE relative to the directory FD is open
@@ -496,7 +499,7 @@ extern int fchownat (int __fd, const char *__file, __uid_t __owner,
/* Change the process's working directory to PATH. */
extern int chdir (const char *__path) __THROW __nonnull ((1)) __wur;
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the process's working directory to the one FD is open on. */
extern int fchdir (int __fd) __THROW __wur;
#endif
@@ -518,7 +521,7 @@ extern char *get_current_dir_name (void) __THROW;
#endif
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
- || defined __USE_BSD
+ || defined __USE_MISC
/* Put the absolute pathname of the current working directory in BUF.
If successful, return BUF. If not, put an error message in
BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
@@ -645,7 +648,7 @@ extern __pid_t getpgid (__pid_t __pid) __THROW;
If PGID is zero, the process ID of the process is used. */
extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;
-#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Both System V and BSD have `setpgrp' functions, but with different
calling conventions. The BSD function is the same as POSIX.1 `setpgid'
(above). The System V function takes no arguments and puts the calling
@@ -659,7 +662,7 @@ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;
This is exactly the same as `setpgid (0, 0)'. */
extern int setpgrp (void) __THROW;
-#endif /* Use SVID or BSD. */
+#endif /* Use misc or X/Open. */
/* Create a new session with the calling process as its leader.
The process group IDs of the session and the calling process
@@ -699,16 +702,16 @@ extern int group_member (__gid_t __gid) __THROW;
if not, the effective user ID is set to UID. */
extern int setuid (__uid_t __uid) __THROW __wur;
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Set the real user ID of the calling process to RUID,
and the effective user ID of the calling process to EUID. */
extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur;
#endif
-#if defined __USE_BSD || defined __USE_XOPEN2K
+#ifdef __USE_XOPEN2K
/* Set the effective user ID of the calling process to UID. */
extern int seteuid (__uid_t __uid) __THROW __wur;
-#endif /* Use BSD. */
+#endif /* Use POSIX.1-2001. */
/* Set the group ID of the calling process to GID.
If the calling process is the super-user, set the real
@@ -716,16 +719,16 @@ extern int seteuid (__uid_t __uid) __THROW __wur;
if not, the effective group ID is set to GID. */
extern int setgid (__gid_t __gid) __THROW __wur;
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Set the real group ID of the calling process to RGID,
and the effective group ID of the calling process to EGID. */
extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur;
#endif
-#if defined __USE_BSD || defined __USE_XOPEN2K
+#ifdef __USE_XOPEN2K
/* Set the effective group ID of the calling process to GID. */
extern int setegid (__gid_t __gid) __THROW __wur;
-#endif /* Use BSD. */
+#endif /* Use POSIX.1-2001. */
#ifdef __USE_GNU
/* Fetch the real user ID, effective user ID, and saved-set user ID,
@@ -756,13 +759,13 @@ extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
extern __pid_t fork (void) __THROWNL;
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
- || defined __USE_BSD
+ || defined __USE_MISC
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
extern __pid_t vfork (void) __THROW;
-#endif /* Use BSD or XPG < 7. */
+#endif /* Use misc or XPG < 7. */
/* Return the pathname of the terminal FD is open on, or NULL on errors.
@@ -778,7 +781,7 @@ extern int ttyname_r (int __fd, char *__buf, size_t __buflen)
with a terminal, zero if not. */
extern int isatty (int __fd) __THROW;
-#if defined __USE_BSD \
+#if defined __USE_MISC \
|| (defined __USE_XOPEN_EXTENDED && !defined __USE_UNIX98)
/* Return the index into the active-logins file (utmp) for
the controlling terminal. */
@@ -798,7 +801,7 @@ extern int linkat (int __fromfd, const char *__from, int __tofd,
__THROW __nonnull ((2, 4)) __wur;
#endif
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
/* Make a symbolic link to FROM named TO. */
extern int symlink (const char *__from, const char *__to)
__THROW __nonnull ((1, 2)) __wur;
@@ -809,7 +812,7 @@ extern int symlink (const char *__from, const char *__to)
extern ssize_t readlink (const char *__restrict __path,
char *__restrict __buf, size_t __len)
__THROW __nonnull ((1, 2)) __wur;
-#endif /* Use BSD. */
+#endif /* Use POSIX.1-2001. */
#ifdef __USE_ATFILE
/* Like symlink but a relative path in TO is interpreted relative to TOFD. */
@@ -857,7 +860,7 @@ extern char *getlogin (void);
extern int getlogin_r (char *__name, size_t __name_len) __nonnull ((1));
#endif
-#ifdef __USE_BSD
+#ifdef __USE_MISC
/* Set the login name returned by `getlogin'. */
extern int setlogin (const char *__name) __THROW __nonnull ((1));
#endif
@@ -872,7 +875,7 @@ extern int setlogin (const char *__name) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Put the name of the current host in no more than LEN bytes of NAME.
The result is null-terminated if LEN is large enough for the full
name and the terminator. */
@@ -880,7 +883,7 @@ extern int gethostname (char *__name, size_t __len) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
+#if defined __USE_MISC
/* Set the name of the current host to NAME, which is LEN bytes long.
This call is restricted to the super-user. */
extern int sethostname (const char *__name, size_t __len)
@@ -935,10 +938,10 @@ extern void setusershell (void) __THROW; /* Rewind and re-read the file. */
terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero,
redirects stdin, stdout, and stderr to /dev/null. */
extern int daemon (int __nochdir, int __noclose) __THROW __wur;
-#endif /* Use BSD || X/Open. */
+#endif /* Use misc. */
-#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
/* Make PATH be the root directory (the starting point for absolute paths).
This call is restricted to the super-user. */
extern int chroot (const char *__path) __THROW __nonnull ((1)) __wur;
@@ -946,7 +949,7 @@ extern int chroot (const char *__path) __THROW __nonnull ((1)) __wur;
/* Prompt with PROMPT and read a string from the terminal without echoing.
Uses /dev/tty if possible; otherwise stderr and stdin. */
extern char *getpass (const char *__prompt) __nonnull ((1));
-#endif /* Use BSD || X/Open. */
+#endif /* Use misc || X/Open. */
/* Make all changes done to FD actually appear on disk.
@@ -963,7 +966,7 @@ extern int syncfs (int __fd) __THROW;
#endif
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Return identifier for the current host. */
extern long int gethostid (void);
@@ -972,7 +975,7 @@ extern long int gethostid (void);
extern void sync (void) __THROW;
-# if defined __USE_BSD || !defined __USE_XOPEN2K
+# if defined __USE_MISC || !defined __USE_XOPEN2K
/* Return the number of bytes in a page. This is the system's page size,
which is not necessarily the same as the hardware page size. */
extern int getpagesize (void) __THROW __attribute__ ((__const__));
@@ -983,10 +986,10 @@ extern int getpagesize (void) __THROW __attribute__ ((__const__));
extern int getdtablesize (void) __THROW;
# endif
-#endif /* Use BSD || X/Open Unix. */
+#endif /* Use misc || X/Open Unix. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Truncate FILE to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
@@ -1006,9 +1009,9 @@ extern int truncate64 (const char *__file, __off64_t __length)
__THROW __nonnull ((1)) __wur;
# endif
-#endif /* Use BSD || X/Open Unix || POSIX 2008. */
+#endif /* Use X/Open Unix || POSIX 2008. */
-#if defined __USE_BSD || defined __USE_POSIX199309 \
+#if defined __USE_POSIX199309 \
|| defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
/* Truncate the file FD is open on to LENGTH bytes. */
@@ -1026,7 +1029,7 @@ extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length),
extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur;
# endif
-#endif /* Use BSD || POSIX.1b || X/Open Unix || XPG6. */
+#endif /* Use POSIX.1b || X/Open Unix || XPG6. */
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
diff --git a/posix/vfork.c b/posix/vfork.c
index 4206168ed2..365088c91e 100644
--- a/posix/vfork.c
+++ b/posix/vfork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2015 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
diff --git a/posix/wait.c b/posix/wait.c
index 706c86ab64..6395e2e928 100644
--- a/posix/wait.c
+++ b/posix/wait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/wait3.c b/posix/wait3.c
index 766b1744a1..818975ec59 100644
--- a/posix/wait3.c
+++ b/posix/wait3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/wait4.c b/posix/wait4.c
index c58cc8dcff..4e8638946f 100644
--- a/posix/wait4.c
+++ b/posix/wait4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
diff --git a/posix/waitid.c b/posix/waitid.c
index 4a0a5a819b..a82462fa80 100644
--- a/posix/waitid.c
+++ b/posix/waitid.c
@@ -1,5 +1,5 @@
/* Stub version of waitid.
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
diff --git a/posix/waitpid.c b/posix/waitpid.c
index 68157830b0..c90437c9bc 100644
--- a/posix/waitpid.c
+++ b/posix/waitpid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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,7 +33,7 @@
Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS,
return status for stopped children; otherwise don't. */
pid_t
-__libc_waitpid (pid_t pid, int *stat_loc, int options)
+__waitpid (pid_t pid, int *stat_loc, int options)
{
if ((options & ~(WNOHANG|WUNTRACED)) != 0)
{
@@ -44,8 +44,7 @@ __libc_waitpid (pid_t pid, int *stat_loc, int options)
__set_errno (ENOSYS);
return (pid_t) -1;
}
-weak_alias (__libc_waitpid, __waitpid)
-libc_hidden_weak (__waitpid)
-weak_alias (__libc_waitpid, waitpid)
+libc_hidden_def (__waitpid)
+weak_alias (__waitpid, waitpid)
stub_warning (waitpid)
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 4957006da7..73f1b7d3ca 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015 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
@@ -17,6 +17,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <pwd.h>
@@ -24,9 +25,29 @@
#include <stdlib.h>
#include <string.h>
#include <wordexp.h>
+#include <libc-internal.h>
#define IFS " \n\t"
+extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
+extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
+
+static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
+{
+ return __register_atfork (prepare, parent, child,
+ &__dso_handle == NULL ? NULL : __dso_handle);
+}
+
+/* Number of forks seen. */
+static int registered_forks;
+
+/* For each fork increment the fork count. */
+static void
+register_fork (void)
+{
+ registered_forks++;
+}
+
struct test_case_struct
{
int retval;
@@ -206,6 +227,17 @@ struct test_case_struct
{ WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS },
{ WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS },
{ WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS },
+ /* Test for CVE-2014-7817. We test 3 combinations of command
+ substitution inside an arithmetic expression to make sure that
+ no commands are executed and error is returned. */
+ { WRDE_CMDSUB, NULL, "$((`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
+ { WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
+ { WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS },
+
+ { WRDE_SYNTAX, NULL, "`\\", 0, 0, { NULL, }, IFS }, /* BZ 18042 */
+ { WRDE_SYNTAX, NULL, "${", 0, 0, { NULL, }, IFS }, /* BZ 18043 */
+ { WRDE_SYNTAX, NULL, "L${a:", 0, 0, { NULL, }, IFS }, /* BZ 18043#c4 */
+ { WRDE_SYNTAX, NULL, "$[1/0]", WRDE_NOCMD, 0, {NULL, }, IFS }, /* BZ 18100 */
{ -1, NULL, NULL, 0, 0, { NULL, }, IFS },
};
@@ -258,6 +290,15 @@ main (int argc, char *argv[])
return -1;
}
+ /* If we are not allowed to do command substitution, we install
+ fork handlers to verify that no forks happened. No forks should
+ happen at all if command substitution is disabled. */
+ if (__app_register_atfork (register_fork, NULL, NULL) != 0)
+ {
+ printf ("Failed to register fork handler.\n");
+ return -1;
+ }
+
for (test = 0; test_case[test].retval != -1; test++)
if (testit (&test_case[test]))
++fail;
@@ -322,6 +363,45 @@ main (int argc, char *argv[])
++fail;
}
+ /* Integer overflow in division. */
+ {
+ static const char *const numbers[] = {
+ "0",
+ "1",
+ "65536",
+ "2147483648",
+ "4294967296"
+ "9223372036854775808",
+ "18446744073709551616",
+ "170141183460469231731687303715884105728",
+ "340282366920938463463374607431768211456",
+ NULL
+ };
+
+ for (const char *const *num = numbers; *num; ++num)
+ {
+ wordexp_t p;
+ char pattern[256];
+ snprintf (pattern, sizeof (pattern), "$[(-%s)/(-1)]", *num);
+ int ret = wordexp (pattern, &p, WRDE_NOCMD);
+ if (ret == 0)
+ {
+ if (p.we_wordc != 1 || strcmp (p.we_wordv[0], *num) != 0)
+ {
+ printf ("Integer overflow for \"%s\" failed", pattern);
+ ++fail;
+ }
+ wordfree (&p);
+ }
+ else if (ret != WRDE_SYNTAX)
+ {
+ printf ("Integer overflow for \"%s\" failed with %d",
+ pattern, ret);
+ ++fail;
+ }
+ }
+ }
+
puts ("tests completed, now cleaning up");
/* Clean up */
@@ -339,6 +419,29 @@ main (int argc, char *argv[])
return fail != 0;
}
+static const char *
+at_page_end (const char *words)
+{
+ const int pagesize = getpagesize ();
+ char *start = mmap (0, 2 * pagesize, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+
+ if (start == MAP_FAILED)
+ return start;
+
+ if (mprotect (start + pagesize, pagesize, PROT_NONE))
+ {
+ munmap (start, 2 * pagesize);
+ return MAP_FAILED;
+ }
+
+ /* Includes terminating NUL. */
+ const size_t words_size = strlen (words) + 1;
+ char *words_start = start + pagesize - words_size;
+ memcpy (words_start, words, words_size);
+
+ return words_start;
+}
static int
testit (struct test_case_struct *tc)
@@ -366,6 +469,11 @@ testit (struct test_case_struct *tc)
we = sav_we;
printf ("Test %d (%s): ", ++tests, tc->words);
+ fflush (NULL);
+ const char *words = at_page_end (tc->words);
+
+ if (tc->flags & WRDE_NOCMD)
+ registered_forks = 0;
if (tc->flags & WRDE_APPEND)
{
@@ -376,7 +484,14 @@ testit (struct test_case_struct *tc)
return 1;
}
}
- retval = wordexp (tc->words, &we, tc->flags);
+ retval = wordexp (words, &we, tc->flags);
+
+ if ((tc->flags & WRDE_NOCMD)
+ && (registered_forks > 0))
+ {
+ printf ("FAILED fork called for WRDE_NOCMD\n");
+ return 1;
+ }
if (tc->flags & WRDE_DOOFFS)
start_offs = sav_we.we_offs;
@@ -433,5 +548,12 @@ testit (struct test_case_struct *tc)
if (retval == 0 || retval == WRDE_NOSPACE)
wordfree (&we);
+ const int page_size = getpagesize ();
+ char *start = (char *) PTR_ALIGN_DOWN (words, page_size);
+
+ if (munmap (start, 2 * page_size) != 0)
+ return 1;
+
+ fflush (NULL);
return bzzzt;
}
diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh
index 392feb0966..83ecc3fae2 100755
--- a/posix/wordexp-tst.sh
+++ b/posix/wordexp-tst.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# Test for wordexp(3).
-# Copyright (C) 1998-2014 Free Software Foundation, Inc.
+# Copyright (C) 1998-2015 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
@@ -24,7 +24,9 @@ set -e
# The others are just there to be parameters.
common_objpfx=$1; shift
-test_program_prefix=$1; shift
+test_program_prefix_before_env=$1; shift
+run_program_env=$1; shift
+test_program_prefix_after_env=$1; shift
logfile=${common_objpfx}posix/wordexp-tst.out
testout=${common_objpfx}posix/wordexp-test-result
@@ -38,7 +40,8 @@ IFS=" \
export IFS
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
wordexp returned 0
@@ -50,7 +53,8 @@ if test $failed -ne 0; then
fi
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2
cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1
wordexp returned 0
@@ -63,7 +67,8 @@ if test $failed -ne 0; then
fi
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3
cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1
wordexp returned 0
@@ -76,7 +81,8 @@ if test $failed -ne 0; then
fi
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4
cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1
wordexp returned 0
@@ -88,7 +94,8 @@ if test $failed -ne 0; then
fi
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5
cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1
wordexp returned 0
@@ -102,7 +109,8 @@ fi
# Why? Because bash does it that way..
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6
cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1
wordexp returned 0
@@ -114,7 +122,8 @@ if test $failed -ne 0; then
fi
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1
wordexp returned 0
@@ -129,7 +138,8 @@ if test $failed -ne 0; then
fi
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8
cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1
wordexp returned 0
@@ -141,7 +151,8 @@ if test $failed -ne 0; then
fi
failed=0
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9
cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1
wordexp returned 0
@@ -154,7 +165,8 @@ if test $failed -ne 0; then
status=1
fi
-${test_program_prefix} \
+${test_program_prefix_before_env} ${run_program_env} IFS="$IFS" \
+${test_program_prefix_after_env} \
${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10
cat <<"EOF" | cmp - ${testout}10 || failed=1
wordexp returned 0
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 366ec18aeb..e711d43355 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1,5 +1,5 @@
/* POSIX.2 wordexp implementation.
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
@@ -617,6 +617,10 @@ eval_expr_multdiv (char **expr, long int *result)
if (eval_expr_val (expr, &arg) != 0)
return WRDE_SYNTAX;
+ /* Division by zero or integer overflow. */
+ if (arg == 0 || (arg == -1 && *result == LONG_MIN))
+ return WRDE_SYNTAX;
+
*result /= arg;
}
else break;
@@ -823,7 +827,7 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
args[1] = "-nc";
/* Redirect output. */
- if (__builtin_expect (fildes[1] != STDOUT_FILENO, 1))
+ if (__glibc_likely (fildes[1] != STDOUT_FILENO))
{
__dup2 (fildes[1], STDOUT_FILENO);
__close (fildes[1]);
@@ -893,6 +897,10 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
pid_t pid;
int noexec = 0;
+ /* Do nothing if command substitution should not succeed. */
+ if (flags & WRDE_NOCMD)
+ return WRDE_CMDSUB;
+
/* Don't fork() unless necessary */
if (!comm || !*comm)
return 0;
@@ -1214,6 +1222,9 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
return WRDE_SYNTAX;
}
+#define CHAR_IN_SET(ch, char_set) \
+ (memchr (char_set "", ch, sizeof (char_set) - 1) != NULL)
+
static int
internal_function
parse_param (char **word, size_t *word_length, size_t *max_length,
@@ -1295,7 +1306,7 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
}
while (isdigit(words[++*offset]));
}
- else if (strchr ("*@$", words[*offset]) != NULL)
+ else if (CHAR_IN_SET (words[*offset], "*@$"))
{
/* Special parameter. */
special = 1;
@@ -1339,7 +1350,7 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
break;
case ':':
- if (strchr ("-=?+", words[1 + *offset]) == NULL)
+ if (!CHAR_IN_SET (words[1 + *offset], "-=?+"))
goto syntax;
colon_seen = 1;
@@ -1908,7 +1919,7 @@ envsubst:
if (pattern && !value)
goto no_space;
- __setenv (env, value, 1);
+ __setenv (env, value ?: "", 1);
break;
default:
@@ -2041,6 +2052,8 @@ do_error:
return error;
}
+#undef CHAR_IN_SET
+
static int
internal_function
parse_dollars (char **word, size_t *word_length, size_t *max_length,
@@ -2082,9 +2095,6 @@ parse_dollars (char **word, size_t *word_length, size_t *max_length,
}
}
- if (flags & WRDE_NOCMD)
- return WRDE_CMDSUB;
-
(*offset) += 2;
return parse_comm (word, word_length, max_length, words, offset, flags,
quoted? NULL : pwordexp, ifs, ifs_white);
@@ -2142,7 +2152,6 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length,
break;
}
- ++(*offset);
error = parse_backslash (&comm, &comm_length, &comm_maxlen, words,
offset);
@@ -2196,9 +2205,6 @@ parse_dquote (char **word, size_t *word_length, size_t *max_length,
break;
case '`':
- if (flags & WRDE_NOCMD)
- return WRDE_CMDSUB;
-
++(*offset);
error = parse_backtick (word, word_length, max_length, words,
offset, flags, NULL, NULL, NULL);
@@ -2357,12 +2363,6 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
break;
case '`':
- if (flags & WRDE_NOCMD)
- {
- error = WRDE_CMDSUB;
- goto do_error;
- }
-
++words_offset;
error = parse_backtick (&word, &word_length, &max_length, words,
&words_offset, flags, pwordexp, ifs,
diff --git a/posix/wordexp.h b/posix/wordexp.h
index f9ba108e37..db238311e1 100644
--- a/posix/wordexp.h
+++ b/posix/wordexp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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