Source-Changes-HG archive

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

[src/trunk]: src/tests/kernel Use /dev/null instead of stdin for fd. Otherwi...



details:   https://anonhg.NetBSD.org/src/rev/31a5e046d225
branches:  trunk
changeset: 763241:31a5e046d225
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Mar 14 20:41:25 2011 +0000

description:
Use /dev/null instead of stdin for fd.  Otherwise if the tests are
run with stdin as a pipe (e.g. from cron) the test fails with ESPIPE.

diffstat:

 tests/kernel/t_posix_fadvise.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 0daeff9cc5c4 -r 31a5e046d225 tests/kernel/t_posix_fadvise.c
--- a/tests/kernel/t_posix_fadvise.c    Mon Mar 14 20:12:40 2011 +0000
+++ b/tests/kernel/t_posix_fadvise.c    Mon Mar 14 20:41:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_posix_fadvise.c,v 1.5 2010/12/30 22:23:13 pooka Exp $ */
+/* $NetBSD: t_posix_fadvise.c,v 1.6 2011/03/14 20:41:25 pooka Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_fadvise.c,v 1.5 2010/12/30 22:23:13 pooka Exp $");
+__RCSID("$NetBSD: t_posix_fadvise.c,v 1.6 2011/03/14 20:41:25 pooka Exp $");
 
 #include <sys/fcntl.h>
 
@@ -88,11 +88,13 @@
 
 ATF_TC_BODY(posix_fadvise, tc)
 {
-       int fd = STDIN_FILENO;
+       int fd;
        int pipe_fds[2];
        int badfd = 10;
        int ret;
 
+       RL(fd = open("/dev/null", O_RDWR));
+
        (void)close(badfd);
        RL(pipe(pipe_fds));
 



Home | Main Index | Thread Index | Old Index