NetBSD Problem Report #51842
From www@NetBSD.org Fri Jan 13 04:53:23 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 271DA7A265
for <gnats-bugs@gnats.NetBSD.org>; Fri, 13 Jan 2017 04:53:23 +0000 (UTC)
Message-Id: <20170113045321.EE5F47A2B6@mollari.NetBSD.org>
Date: Fri, 13 Jan 2017 04:53:21 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libc/sys/t_unlink: don't leak fifo file descriptor
X-Send-Pr-Version: www-1.0
>Number: 51842
>Category: bin
>Synopsis: [PATCH] tests/lib/libc/sys/t_unlink: don't leak fifo file descriptor
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 13 04:55:00 +0000 2017
>Closed-Date: Sun Jan 15 19:32:26 +0000 2017
>Last-Modified: Sun Jan 15 19:32:26 +0000 2017
>Originator: Ngie Cooper
>Release: 7.0.2
>Organization:
>Environment:
n/a
>Description:
Close fd after calling mkfifo(2) to not leak the file descriptor
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/51842: [PATCH] tests/lib/libc/sys/t_unlink: don't leak fifo
file descriptor
Date: Thu, 12 Jan 2017 21:04:14 -0800
--Apple-Mail=_CB4C3FCC-5F35-4A70-8301-98A9BB5BDD57
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
-Ngie
--Apple-Mail=_CB4C3FCC-5F35-4A70-8301-98A9BB5BDD57
Content-Disposition: attachment;
filename=lib-libc-sys-t_unlink-close-fd-after-mkfifo-call.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="lib-libc-sys-t_unlink-close-fd-after-mkfifo-call.patch"
Content-Transfer-Encoding: 7bit
Index: lib/libc/sys/t_unlink.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/sys/t_unlink.c,v
retrieving revision 1.2
diff -u -r1.2 t_unlink.c
--- lib/libc/sys/t_unlink.c 21 Apr 2014 18:05:17 -0000 1.2
+++ lib/libc/sys/t_unlink.c 13 Jan 2017 04:53:13 -0000
@@ -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;
--Apple-Mail=_CB4C3FCC-5F35-4A70-8301-98A9BB5BDD57--
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51842 CVS commit: src/tests/lib/libc/sys
Date: Fri, 13 Jan 2017 14:33:04 -0500
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.
State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sun, 15 Jan 2017 19:32:26 +0000
State-Changed-Why:
christos committed it. thanks!
>Unformatted:
(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.