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/d7da3dbd61ac
branches:  trunk
changeset: 958744:d7da3dbd61ac
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 da5c1db60291 -r d7da3dbd61ac 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