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/3f01d346be9d
branches:  trunk
changeset: 820689:3f01d346be9d
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 2d080a80a86d -r 3f01d346be9d 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