summaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-06-20 02:28:31 +0200
committerThomas Schwinge <thomas@codesourcery.com>2012-06-20 02:28:31 +0200
commit0138137f1ccea480fe31cea3b63a81f96daeeaa7 (patch)
treeffd88f1e805cd98152828c1598fc3255b3d22a9e /posix
parent27fbc2008d4df23885d10f0877caf62ae2c22bb4 (diff)
parentdc665715841aea049480d9f75ace426419db1f8e (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts: configure configure.in hurd/Makefile nptl/sysdeps/pthread/bits/libc-lock.h sysdeps/i386/configure sysdeps/powerpc/powerpc32/configure sysdeps/powerpc/powerpc64/configure sysdeps/unix/sysv/linux/configure sysdeps/unix/sysv/linux/configure.in
Diffstat (limited to 'posix')
-rw-r--r--posix/Makefile20
-rw-r--r--posix/bug-regex33.c119
-rw-r--r--posix/confstr.c223
-rw-r--r--posix/getopt_init.c2
-rw-r--r--posix/regex_internal.c2
-rw-r--r--posix/spawn.h1
-rw-r--r--posix/sys/wait.h8
-rw-r--r--posix/tar.h9
-rw-r--r--posix/unistd.h9
-rw-r--r--posix/wordexp.c2
10 files changed, 251 insertions, 144 deletions
diff --git a/posix/Makefile b/posix/Makefile
index ba892f1893..922f9c0884 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1991-2007,2009,2010,2011,2012 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,13 +29,6 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
bits/sched.h re_comp.h wait.h bits/environments.h cpio.h \
sys/sysmacros.h spawn.h bits/unistd.h
-distribute := confstr.h TESTS TESTS2C.sed testcases.h \
- PTESTS PTESTS2C.sed ptestcases.h \
- globtest.c globtest.sh wordexp-tst.sh annexc.c fnmatch_loop.c \
- spawn_int.h tst-getconf.sh regcomp.c regexec.c regex_internal.c \
- regex_internal.h fork.h rxspencer/tests rxspencer/COPYRIGHT \
- PCRE.tests BOOST.tests
-
routines := \
uname \
times \
@@ -82,7 +75,7 @@ tests := tstgetopt testfnm runtests runptests \
bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
- tst-nice tst-nanosleep tst-regex2 \
+ bug-regex33 tst-nice tst-nanosleep tst-regex2 \
transbug tst-rxspencer tst-pcre tst-boost \
bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
@@ -119,14 +112,6 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
include ../Rules
-ifeq (yes,$(build-static-nss))
-# We need it for "make check" only. We can skip them if they haven't
-# been built yet during "make".
-otherlibs += $(wildcard $(nssobjdir)/libnss_files.a \
- $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a)
-endif
-
ifeq (no,$(cross-compiling))
# globtest and wordexp-test currently only works with shared libraries
ifeq (yes,$(build-shared))
@@ -208,6 +193,7 @@ 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
tst-rxspencer-ARGS = --utf8 rxspencer/tests
tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
tst-pcre-ARGS = PCRE.tests
diff --git a/posix/bug-regex33.c b/posix/bug-regex33.c
new file mode 100644
index 0000000000..f78b354f1a
--- /dev/null
+++ b/posix/bug-regex33.c
@@ -0,0 +1,119 @@
+/* Test re_search with multi-byte characters in EUC-JP.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Stanislav Brabec <sbrabec@suse.cz>, 2012.
+
+ 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/>. */
+
+#define _GNU_SOURCE 1
+#include <locale.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "regex_internal.h"
+
+static int
+do_test (void)
+{
+ struct re_pattern_buffer r;
+ struct re_registers s;
+ int e, rc = 0;
+ if (setlocale (LC_CTYPE, "ja_JP.EUC-JP") == NULL)
+ {
+ puts ("setlocale failed");
+ return 1;
+ }
+ memset (&r, 0, sizeof (r));
+ memset (&s, 0, sizeof (s));
+
+ /* The bug cannot be reproduced without initialized fastmap. */
+ r.fastmap = malloc (SBC_MAX);
+
+ /* 圭 */
+ re_compile_pattern ("\xb7\xbd", 2, &r);
+
+ /* aaaaa件a新処, \xb7\xbd constitutes a false match */
+ e = re_search (&r, "\x61\x61\x61\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8",
+ 12, 0, 12, &s);
+ if (e != -1)
+ {
+ printf ("bug-regex33.1: false match or error: re_search() returned %d, should return -1\n", e);
+ rc = 1;
+ }
+
+ /* aaaa件a新処, \xb7\xbd constitutes a false match,
+ * this is a reproducer of BZ #13637 */
+ e = re_search (&r, "\x61\x61\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8",
+ 11, 0, 11, &s);
+ if (e != -1)
+ {
+ printf ("bug-regex33.2: false match or error: re_search() returned %d, should return -1\n", e);
+ rc = 1;
+ }
+
+ /* aaa件a新処, \xb7\xbd constitutes a false match,
+ * this is a reproducer of BZ #13637 */
+ e = re_search (&r, "\x61\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8",
+ 10, 0, 10, &s);
+ if (e != -1)
+ {
+ printf ("bug-regex33.3: false match or error: re_search() returned %d, should return -1\n", e);
+ rc = 1;
+ }
+
+ /* aa件a新処, \xb7\xbd constitutes a false match */
+ e = re_search (&r, "\x61\x61\xb7\xef\x61\xbf\xb7\xbd\xe8",
+ 9, 0, 9, &s);
+ if (e != -1)
+ {
+ printf ("bug-regex33.4: false match or error: re_search() returned %d, should return -1\n", e);
+ rc = 1;
+ }
+
+ /* a件a新処, \xb7\xbd constitutes a false match */
+ e = re_search (&r, "\x61\xb7\xef\x61\xbf\xb7\xbd\xe8",
+ 8, 0, 8, &s);
+ if (e != -1)
+ {
+ printf ("bug-regex33.5: false match or error: re_search() returned %d, should return -1\n", e);
+ rc = 1;
+ }
+
+ /* 新処圭新処, \xb7\xbd here really matches 圭, but second occurrence is a false match,
+ * this is a reproducer of bug-regex25 and BZ #13637 */
+ e = re_search (&r, "\xbf\xb7\xbd\xe8\xb7\xbd\xbf\xb7\xbd\xe8",
+ 10, 0, 10, &s);
+ if (e != 4)
+ {
+ printf ("bug-regex33.6: no match or false match: re_search() returned %d, should return 4\n", e);
+ rc = 1;
+ }
+
+ /* 新処圭新, \xb7\xbd here really matches 圭,
+ * this is a reproducer of bug-regex25 */
+ e = re_search (&r, "\xbf\xb7\xbd\xe8\xb7\xbd\xbf\xb7",
+ 10, 0, 10, &s);
+ if (e != 4)
+ {
+ printf ("bug-regex33.7: no match or false match: re_search() returned %d, should return 4\n", e);
+ rc = 1;
+ }
+
+ return rc;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/confstr.c b/posix/confstr.c
index 3c9566d1cf..cad65615ad 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,1996,1997,2000-2004,2009,2010 Free
- Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -35,6 +34,10 @@ confstr (name, buf, len)
const char *string = "";
size_t string_len = 1;
+ /* Note that this buffer must be large enough for the longest strings
+ used below. */
+ char restenvs[4 * sizeof "POSIX_V7_LPBIG_OFFBIG"];
+
switch (name)
{
case _CS_PATH:
@@ -53,59 +56,55 @@ confstr (name, buf, len)
wint_t types are no greater than the width of type long.
Currently this means all environment which the system allows. */
- {
- char restenvs[4 * sizeof "POSIX_V7_LPBIG_OFFBIG"];
-
- string_len = 0;
+ string_len = 0;
#ifndef _POSIX_V7_ILP32_OFF32
- if (__sysconf (_SC_V7_ILP32_OFF32) > 0)
+ if (__sysconf (_SC_V7_ILP32_OFF32) > 0)
#endif
#if !defined _POSIX_V7_ILP32_OFF32 || _POSIX_V7_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32",
- sizeof "POSIX_V7_ILP32_OFF32" - 1);
- string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1;
- }
+ {
+ memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32",
+ sizeof "POSIX_V7_ILP32_OFF32" - 1);
+ string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1;
+ }
#endif
#ifndef _POSIX_V7_ILP32_OFFBIG
- if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0)
+ if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0)
#endif
#if !defined _POSIX_V7_ILP32_OFFBIG || _POSIX_V7_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG",
- sizeof "POSIX_V7_ILP32_OFFBIG" - 1);
- string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG",
+ sizeof "POSIX_V7_ILP32_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1;
+ }
#endif
#ifndef _POSIX_V7_LP64_OFF64
- if (__sysconf (_SC_V7_LP64_OFF64) > 0)
+ if (__sysconf (_SC_V7_LP64_OFF64) > 0)
#endif
#if !defined _POSIX_V7_LP64_OFF64 || _POSIX_V7_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64",
- sizeof "POSIX_V7_LP64_OFF64" - 1);
- string_len += sizeof "POSIX_V7_LP64_OFF64" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64",
+ sizeof "POSIX_V7_LP64_OFF64" - 1);
+ string_len += sizeof "POSIX_V7_LP64_OFF64" - 1;
+ }
#endif
#ifndef _POSIX_V7_LPBIG_OFFBIG
- if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0)
+ if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0)
#endif
#if !defined _POSIX_V7_LPBIG_OFFBIG || _POSIX_V7_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG",
- sizeof "POSIX_V7_LPBIG_OFFBIG" - 1);
- string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
- string = restenvs;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG",
+ sizeof "POSIX_V7_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
+ string = restenvs;
break;
case _CS_V6_WIDTH_RESTRICTED_ENVS:
@@ -116,59 +115,55 @@ confstr (name, buf, len)
wint_t types are no greater than the width of type long.
Currently this means all environment which the system allows. */
- {
- char restenvs[4 * sizeof "POSIX_V6_LPBIG_OFFBIG"];
-
- string_len = 0;
+ string_len = 0;
#ifndef _POSIX_V6_ILP32_OFF32
- if (__sysconf (_SC_V6_ILP32_OFF32) > 0)
+ if (__sysconf (_SC_V6_ILP32_OFF32) > 0)
#endif
#if !defined _POSIX_V6_ILP32_OFF32 || _POSIX_V6_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFF32",
- sizeof "POSIX_V6_ILP32_OFF32" - 1);
- string_len += sizeof "POSIX_V6_ILP32_OFF32" - 1;
- }
+ {
+ memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFF32",
+ sizeof "POSIX_V6_ILP32_OFF32" - 1);
+ string_len += sizeof "POSIX_V6_ILP32_OFF32" - 1;
+ }
#endif
#ifndef _POSIX_V6_ILP32_OFFBIG
- if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0)
+ if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0)
#endif
#if !defined _POSIX_V6_ILP32_OFFBIG || _POSIX_V6_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFFBIG",
- sizeof "POSIX_V6_ILP32_OFFBIG" - 1);
- string_len += sizeof "POSIX_V6_ILP32_OFFBIG" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V6_ILP32_OFFBIG",
+ sizeof "POSIX_V6_ILP32_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V6_ILP32_OFFBIG" - 1;
+ }
#endif
#ifndef _POSIX_V6_LP64_OFF64
- if (__sysconf (_SC_V6_LP64_OFF64) > 0)
+ if (__sysconf (_SC_V6_LP64_OFF64) > 0)
#endif
#if !defined _POSIX_V6_LP64_OFF64 || _POSIX_V6_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_LP64_OFF64",
- sizeof "POSIX_V6_LP64_OFF64" - 1);
- string_len += sizeof "POSIX_V6_LP64_OFF64" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V6_LP64_OFF64",
+ sizeof "POSIX_V6_LP64_OFF64" - 1);
+ string_len += sizeof "POSIX_V6_LP64_OFF64" - 1;
+ }
#endif
#ifndef _POSIX_V6_LPBIG_OFFBIG
- if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0)
+ if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0)
#endif
#if !defined _POSIX_V6_LPBIG_OFFBIG || _POSIX_V6_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "POSIX_V6_LPBIG_OFFBIG",
- sizeof "POSIX_V6_LPBIG_OFFBIG" - 1);
- string_len += sizeof "POSIX_V6_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
- string = restenvs;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V6_LPBIG_OFFBIG",
+ sizeof "POSIX_V6_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V6_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
+ string = restenvs;
break;
case _CS_V5_WIDTH_RESTRICTED_ENVS:
@@ -179,59 +174,55 @@ confstr (name, buf, len)
wint_t types are no greater than the width of type long.
Currently this means all environment which the system allows. */
- {
- char restenvs[4 * sizeof "XBS5_LPBIG_OFFBIG"];
-
- string_len = 0;
+ string_len = 0;
#ifndef _XBS5_ILP32_OFF32
- if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0)
+ if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0)
#endif
#if !defined _XBS5_ILP32_OFF32 || _XBS5_ILP32_OFF32 > 0
- {
- memcpy (restenvs + string_len, "XBS5_ILP32_OFF32",
- sizeof "XBS5_ILP32_OFF32" - 1);
- string_len += sizeof "XBS5_ILP32_OFF32" - 1;
- }
+ {
+ memcpy (restenvs + string_len, "XBS5_ILP32_OFF32",
+ sizeof "XBS5_ILP32_OFF32" - 1);
+ string_len += sizeof "XBS5_ILP32_OFF32" - 1;
+ }
#endif
#ifndef _XBS5_ILP32_OFFBIG
- if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0)
+ if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0)
#endif
#if !defined _XBS5_ILP32_OFFBIG || _XBS5_ILP32_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG",
- sizeof "XBS5_ILP32_OFFBIG" - 1);
- string_len += sizeof "XBS5_ILP32_OFFBIG" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG",
+ sizeof "XBS5_ILP32_OFFBIG" - 1);
+ string_len += sizeof "XBS5_ILP32_OFFBIG" - 1;
+ }
#endif
#ifndef _XBS5_LP64_OFF64
- if (__sysconf (_SC_XBS5_LP64_OFF64) > 0)
+ if (__sysconf (_SC_XBS5_LP64_OFF64) > 0)
#endif
#if !defined _XBS5_LP64_OFF64 || _XBS5_LP64_OFF64 > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_LP64_OFF64",
- sizeof "XBS5_LP64_OFF64" - 1);
- string_len += sizeof "XBS5_LP64_OFF64" - 1;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_LP64_OFF64",
+ sizeof "XBS5_LP64_OFF64" - 1);
+ string_len += sizeof "XBS5_LP64_OFF64" - 1;
+ }
#endif
#ifndef _XBS5_LPBIG_OFFBIG
- if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0)
+ if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0)
#endif
#if !defined _XBS5_LPBIG_OFFBIG || _XBS5_LPBIG_OFFBIG > 0
- {
- if (string_len)
- restenvs[string_len++] = '\n';
- memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG",
- sizeof "XBS5_LPBIG_OFFBIG" - 1);
- string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1;
- }
-#endif
- restenvs[string_len++] = '\0';
- string = restenvs;
- }
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG",
+ sizeof "XBS5_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
+ string = restenvs;
break;
case _CS_XBS5_ILP32_OFF32_CFLAGS:
diff --git a/posix/getopt_init.c b/posix/getopt_init.c
index 9bcbd9c00d..55003d4b7e 100644
--- a/posix/getopt_init.c
+++ b/posix/getopt_init.c
@@ -27,7 +27,7 @@
#include <unistd.h>
#include <sys/types.h>
-#include <stdio-common/_itoa.h>
+#include <_itoa.h>
/* Variable to synchronize work. */
char *__getopt_nonoption_flags;
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index 02c871196c..57a23b1f4c 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -504,7 +504,7 @@ re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc)
rawbuf_idx < new_raw_idx;)
{
wchar_t wc2;
- int remain_len = pstr->len - rawbuf_idx;
+ int remain_len = pstr->raw_len - rawbuf_idx;
prev_st = pstr->cur_state;
mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
remain_len, &pstr->cur_state);
diff --git a/posix/spawn.h b/posix/spawn.h
index 36205da7a7..9a82f0367d 100644
--- a/posix/spawn.h
+++ b/posix/spawn.h
@@ -21,6 +21,7 @@
#include <features.h>
#include <sched.h>
+#define __need_sigset_t
#include <signal.h>
#include <sys/types.h>
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index f889ada2a5..07d0374b92 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -28,7 +28,6 @@
__BEGIN_DECLS
#include <signal.h>
-#include <sys/resource.h>
/* These macros could also be defined in <stdlib.h>. */
#if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
@@ -138,8 +137,15 @@ extern __pid_t wait (__WAIT_STATUS __stat_loc);
extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
+# ifndef __id_t_defined
+# include <bits/types.h>
+typedef __id_t id_t;
+# define __id_t_defined
+# endif
+
# define __need_siginfo_t
# include <bits/siginfo.h>
+
/* Wait for a childing matching IDTYPE and ID to change the status and
place appropriate information in *INFOP.
If IDTYPE is P_PID, match any process whose process ID is ID.
diff --git a/posix/tar.h b/posix/tar.h
index 9732d67cb5..be2961ce91 100644
--- a/posix/tar.h
+++ b/posix/tar.h
@@ -1,5 +1,5 @@
/* Extended tar format from POSIX.1.
- Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1996, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by David J. MacKenzie.
@@ -20,6 +20,9 @@
#ifndef _TAR_H
#define _TAR_H 1
+#include <features.h>
+
+
/* A tar archive consists of 512-byte blocks.
Each file in the archive has a header block followed by 0+ data blocks.
Two blocks of NUL bytes indicate the end of the archive. */
@@ -70,7 +73,9 @@
/* The bits in mode: */
#define TSUID 04000
#define TSGID 02000
-#define TSVTX 01000
+#ifdef __USE_XOPEN
+# define TSVTX 01000
+#endif
#define TUREAD 00400
#define TUWRITE 00200
#define TUEXEC 00100
diff --git a/posix/unistd.h b/posix/unistd.h
index ce43450cd4..1f4d64516e 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -971,13 +971,11 @@ extern char *getpass (const char *__prompt) __nonnull ((1));
#endif /* Use BSD || X/Open. */
-#if defined __USE_BSD || defined __USE_XOPEN || defined __USE_XOPEN2K
/* Make all changes done to FD actually appear on disk.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int fsync (int __fd);
-#endif /* Use BSD || X/Open || Unix98. */
#ifdef __USE_GNU
@@ -1032,7 +1030,8 @@ extern int truncate64 (const char *__file, __off64_t __length)
#endif /* Use BSD || X/Open Unix || POSIX 2008. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
+#if defined __USE_BSD || defined __USE_POSIX199309 \
+ || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
/* Truncate the file FD is open on to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
@@ -1049,7 +1048,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 || X/Open Unix || POSIX 2003. */
+#endif /* Use BSD || POSIX.1b || X/Open Unix || XPG6. */
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
@@ -1159,7 +1158,7 @@ extern void swab (const void *__restrict __from, void *__restrict __to,
/* The Single Unix specification demands this prototype to be here.
It is also found in <stdio.h>. */
-#if defined __USE_XOPEN || defined __USE_XOPEN2K8
+#if defined __USE_XOPEN && !defined __USE_XOPEN2K
/* Return the name of the controlling terminal. */
extern char *ctermid (char *__s) __THROW;
#endif
diff --git a/posix/wordexp.c b/posix/wordexp.c
index ece5109ae9..5ace13720b 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -42,7 +42,7 @@
#include <kernel-features.h>
#include <bits/libc-lock.h>
-#include <stdio-common/_itoa.h>
+#include <_itoa.h>
/* Undefine the following line for the production version. */
/* #define NDEBUG 1 */