Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys Check for MAP_FAILED instead of NULL when...



details:   https://anonhg.NetBSD.org/src/rev/096e486ab529
branches:  trunk
changeset: 1018003:096e486ab529
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Jan 18 05:44:20 2021 +0000

description:
Check for MAP_FAILED instead of NULL when looking for an error from mmap(2).

diffstat:

 tests/lib/libc/sys/t_syscall.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r b3c621f28b11 -r 096e486ab529 tests/lib/libc/sys/t_syscall.c
--- a/tests/lib/libc/sys/t_syscall.c    Mon Jan 18 04:35:04 2021 +0000
+++ b/tests/lib/libc/sys/t_syscall.c    Mon Jan 18 05:44:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_syscall.c,v 1.3 2018/05/28 07:55:56 martin Exp $     */
+/*     $NetBSD: t_syscall.c,v 1.4 2021/01/18 05:44:20 simonb Exp $     */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_syscall.c,v 1.3 2018/05/28 07:55:56 martin Exp $");
+__RCSID("$NetBSD: t_syscall.c,v 1.4 2021/01/18 05:44:20 simonb Exp $");
 
 
 #include <atf-c.h>
@@ -75,7 +75,7 @@
 
        p = (const char *)syscall(SYS_mmap,
                0, sizeof(secrect_data), PROT_READ, MAP_PRIVATE, fd, 0, 0, 0);
-       ATF_REQUIRE(p != NULL);
+       ATF_REQUIRE(p != MAP_FAILED);
 
        ATF_REQUIRE(strcmp(p, secrect_data) == 0);
 }
@@ -101,7 +101,7 @@
        p = (const char *)__SYSCALL_TO_UINTPTR_T(__syscall(SYS_mmap,
                0, sizeof(secrect_data), PROT_READ, MAP_PRIVATE, fd,
                /* pad*/ 0, (off_t)0));
-       ATF_REQUIRE(p != NULL);
+       ATF_REQUIRE(p != MAP_FAILED);
 
        ATF_REQUIRE(strcmp(p, secrect_data) == 0);
 }



Home | Main Index | Thread Index | Old Index