NetBSD-Bugs archive

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

Re: bin/51842: [PATCH] tests/lib/libc/sys/t_unlink: don't leak fifo file descriptor



The following reply was made to PR bin/51842; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
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--
 


Home | Main Index | Thread Index | Old Index