@@ -20,22 +20,18 @@
#include <sys/mman.h>
#include <string.h>
#include <unistd.h>
+#include <support/check.h>
+#include <support/next_to_fault.h>
-int
+void
do_bz18036 (void)
{
const char p[] = "**(!()";
- const int pagesize = getpagesize ();
-
- char *pattern = mmap (0, 2 * pagesize, PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
- if (pattern == MAP_FAILED) return 1;
-
- mprotect (pattern + pagesize, pagesize, PROT_NONE);
- memset (pattern, ' ', pagesize);
- strcpy (pattern, p);
-
- return fnmatch (pattern, p, FNM_EXTMATCH);
+ struct support_next_to_fault ntf
+ = support_next_to_fault_allocate (sizeof (p));
+ strcpy (ntf.buffer, p);
+ TEST_COMPARE (fnmatch (ntf.buffer, p, FNM_EXTMATCH), 0);
+ support_next_to_fault_free (&ntf);
}
int
@@ -45,7 +41,8 @@ do_test (void)
return 1;
if (fnmatch ("[a[.\0.]]", "a", 0) != FNM_NOMATCH)
return 1;
- return do_bz18036 ();
+ do_bz18036 ();
+ return 0;
}
#define TEST_FUNCTION do_test ()