diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/Makefile | 1 | ||||
-rw-r--r-- | posix/bug-regex29.c | 22 | ||||
-rw-r--r-- | posix/getconf.c | 1 | ||||
-rw-r--r-- | posix/regcomp.c | 2 | ||||
-rw-r--r-- | posix/unistd.h | 40 |
5 files changed, 59 insertions, 7 deletions
diff --git a/posix/Makefile b/posix/Makefile index 5af49dffd4..f19b121a17 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -82,6 +82,7 @@ tests := tstgetopt testfnm runtests runptests \ bug-regex17 bug-regex18 bug-regex19 bug-regex20 \ bug-regex21 bug-regex22 bug-regex23 bug-regex24 \ bug-regex25 bug-regex26 bug-regex27 bug-regex28 \ + bug-regex29 \ tst-nice tst-nanosleep tst-regex2 \ transbug tst-rxspencer tst-pcre tst-boost \ bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \ diff --git a/posix/bug-regex29.c b/posix/bug-regex29.c new file mode 100644 index 0000000000..bd796c6c2a --- /dev/null +++ b/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/posix/getconf.c b/posix/getconf.c index 59ccab606c..bd7dff7167 100644 --- a/posix/getconf.c +++ b/posix/getconf.c @@ -484,6 +484,7 @@ static const struct conf vars[] = #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 }, diff --git a/posix/regcomp.c b/posix/regcomp.c index 4843cfea33..446fed5445 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -2481,7 +2481,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/posix/unistd.h b/posix/unistd.h index 24ec74e05e..a487883eb8 100644 --- a/posix/unistd.h +++ b/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 |