NetBSD-Bugs archive

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

Re: bin/51868: [PATCH] tests/lib/libc/c063/t_mkfifoat and tests/lib/libc/sys/t_unlock: mkfifo* fixes



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

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51868: [PATCH] tests/lib/libc/c063/t_mkfifoat and
 tests/lib/libc/sys/t_unlock: mkfifo* fixes
Date: Fri, 13 Jan 2017 19:15:52 -0800

 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8
 
 Patched attached =E2=80=94 sorry for the t_unlink bug >_>=E2=80=A6
 -Ngie
 
 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB
 Content-Disposition: attachment;
 	filename=t_mkfifoat-fix-incorrect-closing-of-mkfifoat-results.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_mkfifoat-fix-incorrect-closing-of-mkfifoat-results.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: lib/libc/c063/t_mkfifoat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_mkfifoat.c,v
 retrieving revision 1.3
 diff -u -r1.3 t_mkfifoat.c
 --- lib/libc/c063/t_mkfifoat.c	10 Jan 2017 15:15:09 -0000	1.3
 +++ lib/libc/c063/t_mkfifoat.c	14 Jan 2017 03:09:52 -0000
 @@ -55,13 +55,11 @@
  ATF_TC_BODY(mkfifoat_fd, tc)
  {
  	int dfd;
 -	int fd;
  	mode_t mode = 0600;
  
  	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
  	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
 -	ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
 -	ATF_REQUIRE(close(fd) == 0);
 +	ATF_REQUIRE(mkfifoat(dfd, BASEFIFO, mode) != -1);
  	ATF_REQUIRE(access(FIFO, F_OK) == 0);
  	(void)close(dfd);
  }
 @@ -74,12 +72,10 @@
  }
  ATF_TC_BODY(mkfifoat_fdcwd, tc)
  {
 -	int fd;
  	mode_t mode = 0600;
  
  	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
 -	ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFO, mode)) != -1);
 -	ATF_REQUIRE(close(fd) == 0);
 +	ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFO, mode) != -1);
  	ATF_REQUIRE(access(FIFO, F_OK) == 0);
  }
  
 @@ -91,10 +87,9 @@
  }
  ATF_TC_BODY(mkfifoat_fdcwderr, tc)
  {
 -	int fd;
  	mode_t mode = 0600;
  
 -	ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFOERR, mode)) == -1);
 +	ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFOERR, mode) == -1);
  }
  
  ATF_TC(mkfifoat_fderr);
 @@ -110,7 +105,7 @@
  	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
  	ATF_REQUIRE((fd = open(FIFO, O_CREAT|O_RDWR, 0644)) != -1);
  	ATF_REQUIRE(close(fd) == 0);
 -	ATF_REQUIRE((fd = mkfifoat(-1, FIFO, mode)) == -1);
 +	ATF_REQUIRE(mkfifoat(-1, FIFO, mode) == -1);
  }
  
  ATF_TP_ADD_TCS(tp)
 
 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB
 Content-Disposition: attachment;
 	filename=t_unlink-fix-bogus-mkfifo-result-closing.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_unlink-fix-bogus-mkfifo-result-closing.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.3
 diff -u -r1.3 t_unlink.c
 --- lib/libc/sys/t_unlink.c	13 Jan 2017 19:33:03 -0000	1.3
 +++ lib/libc/sys/t_unlink.c	14 Jan 2017 03:10:22 -0000
 @@ -107,11 +107,8 @@
  
  ATF_TC_BODY(unlink_fifo, tc)
  {
 -	int fd;
  
 -	ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
 -	    "mkfifo failed: %s", strerror(errno));
 -	(void)close(fd);
 +	ATF_REQUIRE(mkfifo(path, 0666) == 0);
  	ATF_REQUIRE(unlink(path) == 0);
  
  	errno = 0;
 
 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB--
 



Home | Main Index | Thread Index | Old Index