about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
Diffstat (limited to 'posix')
-rw-r--r--posix/Versions3
-rw-r--r--posix/regexec.c22
2 files changed, 24 insertions, 1 deletions
diff --git a/posix/Versions b/posix/Versions
index c68594acb5..4e6f200aa0 100644
--- a/posix/Versions
+++ b/posix/Versions
@@ -119,6 +119,9 @@ libc {
   GLIBC_2.3.3 {
     sched_getaffinity; sched_setaffinity;
   }
+  GLIBC_2.3.4 {
+    regexec;
+  }
   GLIBC_PRIVATE {
     # functions which have an additional interface since they are
     # are cancelable.
diff --git a/posix/regexec.c b/posix/regexec.c
index ad62178bbd..88d05b5dbe 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -216,6 +216,10 @@ regexec (preg, string, nmatch, pmatch, eflags)
 {
   reg_errcode_t err;
   int start, length;
+
+  if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
+    return REG_BADPAT;
+
   if (eflags & REG_STARTEND)
     {
       start = pmatch[0].rm_so;
@@ -234,8 +238,24 @@ regexec (preg, string, nmatch, pmatch, eflags)
 			      length, nmatch, pmatch, eflags);
   return err != REG_NOERROR;
 }
+
 #ifdef _LIBC
-weak_alias (__regexec, regexec)
+# include <shlib-compat.h>
+versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
+
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+__typeof__ (__regexec) __compat_regexec;
+
+int
+__compat_regexec (const regex_t *__restrict preg,
+		  const char *__restrict string, size_t nmatch,
+		  regmatch_t pmatch[], int eflags)
+{
+  return regexec (preg, string, nmatch, pmatch,
+		  eflags & (REG_NOTBOL | REG_NOTEOL));
+}
+compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
+# endif
 #endif
 
 /* Entry points for GNU code.  */