Module Name:    src
Committed By:   martin
Date:           Wed May 23 16:08:32 UTC 2012

Modified Files:
        src/tests/lib/libc/sys: t_mincore.c

Log Message:
Simplify creation of a temporary file slightly, fix sizeof(buf) confusion
when buf is a pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_mincore.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/sys/t_mincore.c
diff -u src/tests/lib/libc/sys/t_mincore.c:1.4 src/tests/lib/libc/sys/t_mincore.c:1.5
--- src/tests/lib/libc/sys/t_mincore.c:1.4	Wed Mar 14 11:50:52 2012
+++ src/tests/lib/libc/sys/t_mincore.c	Wed May 23 16:08:32 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mincore.c,v 1.4 2012/03/14 11:50:52 jruoho Exp $ */
+/* $NetBSD: t_mincore.c,v 1.5 2012/05/23 16:08:32 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mincore.c,v 1.4 2012/03/14 11:50:52 jruoho Exp $");
+__RCSID("$NetBSD: t_mincore.c,v 1.5 2012/05/23 16:08:32 martin Exp $");
 
 #include <sys/mman.h>
 #include <sys/shm.h>
@@ -141,7 +141,6 @@ ATF_TC_BODY(mincore_resid, tc)
 	void *addr, *addr2, *addr3, *buf;
 	size_t npgs = 0;
 	struct stat st;
-	ssize_t tot;
 	int fd, rv;
 
 	(void)memset(&st, 0, sizeof(struct stat));
@@ -152,15 +151,8 @@ ATF_TC_BODY(mincore_resid, tc)
 	ATF_REQUIRE(fd >= 0);
 	ATF_REQUIRE(buf != NULL);
 
-	tot = 0;
-
-	while (tot < page) {
-
-		rv = write(fd, buf, sizeof(buf));
-		ATF_REQUIRE(rv >= 0);
-
-		tot += rv;
-	}
+	rv = write(fd, buf, page * 5);
+	ATF_REQUIRE(rv >= 0);
 
 	ATF_REQUIRE(fd >= 0);
 	ATF_REQUIRE(fstat(fd, &st) == 0);

Reply via email to