NetBSD-Bugs archive

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

Re: bin/51808: [PATCH] tests/lib/libc/gen/t_dir: fix various coverity issues



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

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/51808: [PATCH] tests/lib/libc/gen/t_dir: fix various coverity
 issues
Date: Tue, 10 Jan 2017 23:11:10 -0800

 --Apple-Mail=_D5AF5B24-B98B-45A9-951C-736BB1D6B3AC
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8
 
 I goofed up the CREAT macro a bit =E2=80=94 it should be checking for a =
 return code not equal to -1, not a non-zero exit code =E2=80=94 sorry =
 :/=E2=80=A6
 -Ngie
 
 
 --Apple-Mail=_D5AF5B24-B98B-45A9-951C-736BB1D6B3AC
 Content-Disposition: attachment;
 	filename=fix-CREAT-macro-added-in-1_7.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="fix-CREAT-macro-added-in-1_7.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: t_dir.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/gen/t_dir.c,v
 retrieving revision 1.7
 diff -u -r1.7 t_dir.c
 --- t_dir.c	10 Jan 2017 15:19:00 -0000	1.7
 +++ t_dir.c	11 Jan 2017 07:07:46 -0000
 @@ -55,12 +55,12 @@
  	struct dirent *entry;
  	long here;
  
 -#define	CREAT(x, m)	do {					\
 -		int _creat_fd;					\
 -		ATF_REQUIRE_MSG((_creat_fd = creat((x), (m))),	\
 -		    "creat(%s, %x) failed: %s", (x), (m),	\
 -		    strerror(errno));				\
 -		(void)close(_creat_fd);			\
 +#define	CREAT(x, m)	do {						\
 +		int _creat_fd;						\
 +		ATF_REQUIRE_MSG((_creat_fd = creat((x), (m)) != -1),	\
 +		    "creat(%s, %x) failed: %s", (x), (m),		\
 +		    strerror(errno));					\
 +		(void)close(_creat_fd);					\
  	} while(0);
  
  	ATF_REQUIRE_MSG(mkdir("t", 0755) == 0,
 
 --Apple-Mail=_D5AF5B24-B98B-45A9-951C-736BB1D6B3AC--
 



Home | Main Index | Thread Index | Old Index