Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/c063 PR/51805: Ngie Cooper: Fix file descript...



details:   https://anonhg.NetBSD.org/src/rev/628ed686c97d
branches:  trunk
changeset: 820472:628ed686c97d
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 10 15:15:09 2017 +0000

description:
PR/51805: Ngie Cooper: Fix file descriptor leaks

diffstat:

 tests/lib/libc/c063/t_fexecve.c  |  5 +++--
 tests/lib/libc/c063/t_mkfifoat.c |  5 +++--
 tests/lib/libc/c063/t_mknodat.c  |  5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diffs (78 lines):

diff -r 1436b3794005 -r 628ed686c97d tests/lib/libc/c063/t_fexecve.c
--- a/tests/lib/libc/c063/t_fexecve.c   Tue Jan 10 15:13:56 2017 +0000
+++ b/tests/lib/libc/c063/t_fexecve.c   Tue Jan 10 15:15:09 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $ */
+/*     $NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $");
+__RCSID("$NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
 
 #include <sys/wait.h>
 
@@ -70,6 +70,7 @@
                                error = 76;
                        else
                                error = EXIT_FAILURE;
+                       (void)close(fd);
                        err(error, "fexecve");
                }
        }
diff -r 1436b3794005 -r 628ed686c97d tests/lib/libc/c063/t_mkfifoat.c
--- a/tests/lib/libc/c063/t_mkfifoat.c  Tue Jan 10 15:13:56 2017 +0000
+++ b/tests/lib/libc/c063/t_mkfifoat.c  Tue Jan 10 15:15:09 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_mkfifoat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/*     $NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mkfifoat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
 
 #include <atf-c.h>
 #include <errno.h>
@@ -63,6 +63,7 @@
        ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
        ATF_REQUIRE(close(fd) == 0);
        ATF_REQUIRE(access(FIFO, F_OK) == 0);
+       (void)close(dfd);
 }
 
 ATF_TC(mkfifoat_fdcwd);
diff -r 1436b3794005 -r 628ed686c97d tests/lib/libc/c063/t_mknodat.c
--- a/tests/lib/libc/c063/t_mknodat.c   Tue Jan 10 15:13:56 2017 +0000
+++ b/tests/lib/libc/c063/t_mknodat.c   Tue Jan 10 15:15:09 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/*     $NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $");
 
 #include <atf-c.h>
 #include <errno.h>
@@ -80,6 +80,7 @@
        ATF_REQUIRE((fd = mknodat(dfd, BASEFILE, mode, dev)) != -1);
        ATF_REQUIRE(close(fd) == 0);
        ATF_REQUIRE(access(FILE, F_OK) == 0);
+       (void)close(dfd);
 }
 
 ATF_TC(mknodat_fdcwd);



Home | Main Index | Thread Index | Old Index