From c69613ea1ef3302d0c1150bd02a26d757f41c252 Mon Sep 17 00:00:00 2001 From: jruoho Date: Fri, 20 Apr 2012 05:15:11 +0000 Subject: [PATCH] Close all file descriptors before trying to reason about the number of open descriptors. Should fix the test failures reported on current users. --- tests/lib/librumphijack/h_client.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/lib/librumphijack/h_client.c b/tests/lib/librumphijack/h_client.c index 14abd778c4df..20add7394d8d 100644 --- a/tests/lib/librumphijack/h_client.c +++ b/tests/lib/librumphijack/h_client.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_client.c,v 1.7 2012/04/17 09:23:21 jruoho Exp $ */ +/* $NetBSD: h_client.c,v 1.8 2012/04/20 05:15:11 jruoho Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -115,12 +115,15 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; } else if (strcmp(argv[1], "fdoff8") == 0) { + + (void)closefrom(0); + int fd; - do + do { if ((fd = open("/dev/null", O_RDWR)) == -1) err(EXIT_FAILURE, "open1"); - while (fd < 7); + } while (fd < 7); fd = open("/dev/null", O_RDWR); if (fd != -1 || errno != ENFILE) errx(EXIT_FAILURE, "unexpected fd8 %d %d", fd, errno);