summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/sys/uvm/wx_syscall/wx_syscall.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/regress/sys/uvm/wx_syscall/wx_syscall.c b/regress/sys/uvm/wx_syscall/wx_syscall.c
index c067ac849ab..b272f2c3e0c 100644
--- a/regress/sys/uvm/wx_syscall/wx_syscall.c
+++ b/regress/sys/uvm/wx_syscall/wx_syscall.c
@@ -1,10 +1,12 @@
#include <sys/types.h>
#include <sys/mman.h>
+
+#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
+#include <unistd.h>
int
main()
@@ -13,11 +15,15 @@ main()
int psz = getpagesize();
printf("%llx\n", (long long)flock);
- if (mprotect((void *)(o & ~(psz-1)), psz,
- PROT_EXEC|PROT_WRITE|PROT_READ) == -1 &&
- errno == ENOTSUP) {
- printf("mprotect -> ENOTSUP? Please run from wxallowed filesystem\n");
- exit(0);
+ if (mprotect((void *)(o & ~(psz - 1)), psz,
+ PROT_EXEC|PROT_WRITE|PROT_READ) == -1) {
+ if (errno == ENOTSUP) {
+ printf("mprotect -> ENOTSUP? Please run from "
+ "wxallowed filesystem\n");
+ exit(0);
+ } else {
+ err(1, "mprotect");
+ }
}
flock(0, 0);