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 Fix a test case to test what the comment ...



details:   https://anonhg.NetBSD.org/src/rev/89ec96c57929
branches:  trunk
changeset: 770795:89ec96c57929
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Nov 02 06:04:48 2011 +0000

description:
Fix a test case to test what the comment says.

diffstat:

 tests/lib/libc/sys/t_mkfifo.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (60 lines):

diff -r 7320cc16e37e -r 89ec96c57929 tests/lib/libc/sys/t_mkfifo.c
--- a/tests/lib/libc/sys/t_mkfifo.c     Wed Nov 02 05:24:55 2011 +0000
+++ b/tests/lib/libc/sys/t_mkfifo.c     Wed Nov 02 06:04:48 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mkfifo.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */
+/* $NetBSD: t_mkfifo.c,v 1.2 2011/11/02 06:04:48 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mkfifo.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $");
+__RCSID("$NetBSD: t_mkfifo.c,v 1.2 2011/11/02 06:04:48 jruoho Exp $");
 
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -72,12 +72,11 @@
 
 ATF_TC_BODY(mkfifo_block, tc)
 {
-       int fd[2], sta;
+       int sta, fd = -1;
        pid_t pid;
 
        support();
 
-       fd[0] = fd[1] = -1;
        ATF_REQUIRE(mkfifo(path, 0600) == 0);
 
        pid = fork();
@@ -90,16 +89,13 @@
                 * the call should block until another process
                 * opens the FIFO for writing (reading).
                 */
-               fd[0] = open(path, O_RDONLY);
+               fd = open(path, O_RDONLY);
 
-               (void)pause();
-
-               _exit(EXIT_SUCCESS); /* NOTREACHED */
+               _exit(EXIT_FAILURE); /* NOTREACHED */
        }
 
        (void)sleep(1);
 
-       fd[1] = open(path, O_WRONLY);
        ATF_REQUIRE(kill(pid, SIGKILL) == 0);
 
        (void)wait(&sta);
@@ -107,7 +103,7 @@
        if (WIFSIGNALED(sta) == 0 || WTERMSIG(sta) != SIGKILL)
                atf_tc_fail("FIFO did not block");
 
-       (void)close(fd[0]);
+       (void)close(fd);
        (void)unlink(path);
 }
 



Home | Main Index | Thread Index | Old Index