NetBSD Problem Report #51805

From www@NetBSD.org  Tue Jan 10 08:41:34 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 162717A20D
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Jan 2017 08:41:34 +0000 (UTC)
Message-Id: <20170110084133.2F1847A2A3@mollari.NetBSD.org>
Date: Tue, 10 Jan 2017 08:41:33 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Fix file descriptor leaks in tests/lib/libc/c063/...
X-Send-Pr-Version: www-1.0

>Number:         51805
>Category:       bin
>Synopsis:       Fix file descriptor leaks in tests/lib/libc/c063/...
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 10 08:45:00 +0000 2017
>Closed-Date:    Tue Jan 10 18:12:09 +0000 2017
>Last-Modified:  Tue Jan 10 18:12:09 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2
>Organization:
>Environment:
n/a
>Description:
The attached patch addresses several file descriptor leaks in tests/lib/libc/c063/... reported by Coverity with the following CIDs: 978285, 978286, 978287.

Patch coming soon.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51805: Fix file descriptor leaks in tests/lib/libc/c063/...
Date: Tue, 10 Jan 2017 00:45:55 -0800

 --Apple-Mail=_D402DE51-F1C3-4A32-AE08-E5546E7E10B7
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Patch attached.

 --Apple-Mail=_D402DE51-F1C3-4A32-AE08-E5546E7E10B7
 Content-Disposition: attachment;
 	filename=dont-leak-fd-when-done.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="dont-leak-fd-when-done.patch"
 Content-Transfer-Encoding: 7bit

 Index: t_mkfifoat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_mkfifoat.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_mkfifoat.c
 --- t_mkfifoat.c	17 Mar 2013 04:46:06 -0000	1.2
 +++ t_mkfifoat.c	10 Jan 2017 08:29:21 -0000
 @@ -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);
 Index: t_mknodat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_mknodat.c,v
 retrieving revision 1.3
 diff -u -r1.3 t_mknodat.c
 --- t_mknodat.c	17 Mar 2013 04:46:06 -0000	1.3
 +++ t_mknodat.c	10 Jan 2017 08:29:21 -0000
 @@ -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);
 Index: t_fexecve.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_fexecve.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_fexecve.c
 --- t_fexecve.c	17 Mar 2013 04:35:59 -0000	1.2
 +++ t_fexecve.c	10 Jan 2017 08:29:21 -0000
 @@ -70,6 +70,7 @@
  				error = 76;
  			else
  				error = EXIT_FAILURE;
 +			(void)close(fd);
  			err(error, "fexecve");
  		}
  	}

 --Apple-Mail=_D402DE51-F1C3-4A32-AE08-E5546E7E10B7--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51805 CVS commit: src/tests/lib/libc/c063
Date: Tue, 10 Jan 2017 10:15:09 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Tue Jan 10 15:15:09 UTC 2017

 Modified Files:
 	src/tests/lib/libc/c063: t_fexecve.c t_mkfifoat.c t_mknodat.c

 Log Message:
 PR/51805: Ngie Cooper: Fix file descriptor leaks


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/c063/t_fexecve.c \
     src/tests/lib/libc/c063/t_mkfifoat.c
 cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/c063/t_mknodat.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 10 Jan 2017 18:12:09 +0000
State-Changed-Why:
christos committed it, thanks


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.