regex: re_search etc. should return -2 when memory exhausted
[gnulib.git] / lib / regexec.c
index 660d25b..5cbfa91 100644 (file)
@@ -475,7 +475,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
 
   /* I hope we needn't fill ther regs with -1's when no match was found.  */
   if (result != REG_NOERROR)
-    rval = -1;
+    rval = result == REG_NOMATCH ? -1 : -2;
   else if (regs != NULL)
     {
       /* If caller wants register contents data back, copy them.  */