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 Simplify creation of a temporary file sli...
details: https://anonhg.NetBSD.org/src/rev/bcfb8b49f2cb
branches: trunk
changeset: 779373:bcfb8b49f2cb
user: martin <martin%NetBSD.org@localhost>
date: Wed May 23 16:08:32 2012 +0000
description:
Simplify creation of a temporary file slightly, fix sizeof(buf) confusion
when buf is a pointer.
diffstat:
tests/lib/libc/sys/t_mincore.c | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)
diffs (44 lines):
diff -r 06f843fac537 -r bcfb8b49f2cb tests/lib/libc/sys/t_mincore.c
--- a/tests/lib/libc/sys/t_mincore.c Wed May 23 14:59:21 2012 +0000
+++ b/tests/lib/libc/sys/t_mincore.c Wed May 23 16:08:32 2012 +0000
@@ -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 @@
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_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);
Home |
Main Index |
Thread Index |
Old Index