syscalls/mprotect: Fix mmap() error checks.
The addr < 0 is always true. Make use of proper MAP_FAILED constant
instead.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/testcases/kernel/syscalls/mprotect/mprotect01.c b/testcases/kernel/syscalls/mprotect/mprotect01.c
index b781968..fef0df6 100644
--- a/testcases/kernel/syscalls/mprotect/mprotect01.c
+++ b/testcases/kernel/syscalls/mprotect/mprotect01.c
@@ -162,7 +162,7 @@
* mmap the PAGESIZE bytes as read only.
*/
addr3 = mmap(0, PAGESIZE, PROT_READ, MAP_SHARED, fd, 0);
- if (addr3 < 0)
+ if (addr3 == MAP_FAILED)
tst_brkm(TBROK, cleanup, "mmap failed");
}
diff --git a/testcases/kernel/syscalls/mprotect/mprotect03.c b/testcases/kernel/syscalls/mprotect/mprotect03.c
index 49212f3..81a3296 100644
--- a/testcases/kernel/syscalls/mprotect/mprotect03.c
+++ b/testcases/kernel/syscalls/mprotect/mprotect03.c
@@ -87,7 +87,7 @@
*/
addr = mmap(0, strlen(buf), PROT_READ | PROT_WRITE, MAP_SHARED,
fd, 0);
- if (addr < 0)
+ if (addr == MAP_FAILED)
tst_brkm(TBROK, cleanup, "mmap failed");
/*