summaryrefslogtreecommitdiff
path: root/libc/posix
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-08-25 15:16:23 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-08-25 15:16:23 +0000
commit36ee53dd0120e48bab5f6793e149d3b4df6fb3ee (patch)
tree1fe31a4c64b9d4225e96674a5f5b9dc2fab6fba4 /libc/posix
parent5aa1a5ac2772b35cf67fa77bdb37a0423876f820 (diff)
downloadeglibc2-36ee53dd0120e48bab5f6793e149d3b4df6fb3ee.tar.gz
Merge changes between r8789 and r8871 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@8872 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/posix')
-rw-r--r--libc/posix/Makefile2
-rw-r--r--libc/posix/bug-regex29.c22
-rw-r--r--libc/posix/regcomp.c2
-rw-r--r--libc/posix/unistd.h40
4 files changed, 58 insertions, 8 deletions
diff --git a/libc/posix/Makefile b/libc/posix/Makefile
index e978ecc7f..619c9bb8c 100644
--- a/libc/posix/Makefile
+++ b/libc/posix/Makefile
@@ -93,7 +93,7 @@ tests := tstgetopt testfnm runtests \
bug-regex8 bug-regex9 bug-regex10 bug-regex12 \
bug-regex14 bug-regex15 \
bug-regex21 bug-regex24 \
- bug-regex27 bug-regex28 \
+ bug-regex27 bug-regex28 bug-regex29 \
tst-nice tst-nanosleep \
transbug \
tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
diff --git a/libc/posix/bug-regex29.c b/libc/posix/bug-regex29.c
new file mode 100644
index 000000000..bd796c6c2
--- /dev/null
+++ b/libc/posix/bug-regex29.c
@@ -0,0 +1,22 @@
+#include <regex.h>
+
+static int
+do_test (void)
+{
+ regex_t r;
+ int e = regcomp(&r, "xy\\{4,5,7\\}zabc", 0);
+ char buf[100];
+ regerror(e, &r, buf, sizeof (buf));
+ printf ("e = %d (%s)\n", e, buf);
+ int res = e != REG_BADBR;
+
+ e = regcomp(&r, "xy\\{4,5a\\}zabc", 0);
+ regerror(e, &r, buf, sizeof (buf));
+ printf ("e = %d (%s)\n", e, buf);
+ res |= e != REG_BADBR;
+
+ return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/posix/regcomp.c b/libc/posix/regcomp.c
index 312d83b1a..e2e9ad01f 100644
--- a/libc/posix/regcomp.c
+++ b/libc/posix/regcomp.c
@@ -2489,7 +2489,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
return elem;
}
- if (BE (end != -1 && start > end, 0))
+ if (BE ((end != -1 && start > end) || token->type != OP_CLOSE_DUP_NUM, 0))
{
/* First number greater than second. */
*err = REG_BADBR;
diff --git a/libc/posix/unistd.h b/libc/posix/unistd.h
index cbab9f939..d9ecb5e78 100644
--- a/libc/posix/unistd.h
+++ b/libc/posix/unistd.h
@@ -30,30 +30,58 @@ __BEGIN_DECLS
/* These may be used to determine what facilities are present at compile time.
Their values can be obtained at run time from `sysconf'. */
+#ifdef __USE_XOPEN2K8
/* POSIX Standard approved as ISO/IEC 9945-1 as of September 2008. */
-#define _POSIX_VERSION 200809L
+# define _POSIX_VERSION 200809L
+#elif defined __USE_XOPEN2K
+/* POSIX Standard approved as ISO/IEC 9945-1 as of December 2001. */
+# define _POSIX_VERSION 200112L
+#elif defined __USE_POSIX199506
+/* POSIX Standard approved as ISO/IEC 9945-1 as of June 1995. */
+# define _POSIX_VERSION 199506L
+#elif defined __USE_POSIX199309
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1993. */
+# define _POSIX_VERSION 199309L
+#else
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1990. */
+# define _POSIX_VERSION 199009L
+#endif
/* These are not #ifdef __USE_POSIX2 because they are
in the theoretically application-owned namespace. */
+#ifdef __USE_XOPEN2K8
+# define __POSIX2_THIS_VERSION 200809L
+/* The utilities on GNU systems also correspond to this version. */
+#elif defined __USE_XOPEN2K
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 200112L
+#elif defined __USE_POSIX199506
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 199506L
+#else
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 199209L
+#endif
+
/* The utilities on GNU systems also correspond to this version. */
-#define _POSIX2_VERSION 200809L
+#define _POSIX2_VERSION __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
C Language Bindings Option. */
-#define _POSIX2_C_BIND 200809L
+#define _POSIX2_C_BIND __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
C Language Development Utilities Option. */
-#define _POSIX2_C_DEV 200809L
+#define _POSIX2_C_DEV __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
Software Development Utilities Option. */
-#define _POSIX2_SW_DEV 200809L
+#define _POSIX2_SW_DEV __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
creation of locales with the localedef utility. */
-#define _POSIX2_LOCALEDEF 200809L
+#define _POSIX2_LOCALEDEF __POSIX2_THIS_VERSION
/* X/Open version number to which the library conforms. It is selectable. */
#ifdef __USE_XOPEN2K8