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 PR/51842: Ngie Cooper: don't leak fifo fi...



details:   https://anonhg.NetBSD.org/src/rev/a43aa88c2617
branches:  trunk
changeset: 350547:a43aa88c2617
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 13 19:33:03 2017 +0000

description:
PR/51842: Ngie Cooper: don't leak fifo file descriptor

diffstat:

 tests/lib/libc/sys/t_unlink.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 0069e75cb7d9 -r a43aa88c2617 tests/lib/libc/sys/t_unlink.c
--- a/tests/lib/libc/sys/t_unlink.c     Fri Jan 13 19:30:38 2017 +0000
+++ b/tests/lib/libc/sys/t_unlink.c     Fri Jan 13 19:33:03 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $ */
+/* $NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $");
+__RCSID("$NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $");
 
 #include <sys/stat.h>
 
@@ -107,8 +107,11 @@
 
 ATF_TC_BODY(unlink_fifo, tc)
 {
+       int fd;
 
-       ATF_REQUIRE(mkfifo(path, 0666) == 0);
+       ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
+           "mkfifo failed: %s", strerror(errno));
+       (void)close(fd);
        ATF_REQUIRE(unlink(path) == 0);
 
        errno = 0;



Home | Main Index | Thread Index | Old Index