Module Name: src
Committed By: christos
Date: Fri Jan 13 19:33:03 UTC 2017
Modified Files:
src/tests/lib/libc/sys: t_unlink.c
Log Message:
PR/51842: Ngie Cooper: don't leak fifo file descriptor
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_unlink.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/sys/t_unlink.c
diff -u src/tests/lib/libc/sys/t_unlink.c:1.2 src/tests/lib/libc/sys/t_unlink.c:1.3
--- src/tests/lib/libc/sys/t_unlink.c:1.2 Mon Apr 21 14:05:17 2014
+++ src/tests/lib/libc/sys/t_unlink.c Fri Jan 13 14:33:03 2017
@@ -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_HEAD(unlink_fifo, tc)
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;