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: Wed, 11 Jan 2017 00:59:55 -0800

 --Apple-Mail=_C3310D0C-92A0-4EFF-A753-AAF8944721E1
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8
 
 I guess it=E2=80=99s for the better that I forgot =E2=80=94 I didn=E2=80=99=
 t include a check for readdir returning NULL that I had added on FreeBSD =
 to address another Coverity issue (I just wish I had gotten this on try =
 # 2).
 -Ngie
 
 
 --Apple-Mail=_C3310D0C-92A0-4EFF-A753-AAF8944721E1
 Content-Disposition: attachment;
 	filename=t_dir-last-bit-of-fixes.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_dir-last-bit-of-fixes.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: t_dir.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/gen/t_dir.c,v
 retrieving revision 1.8
 diff -u -r1.8 t_dir.c
 --- t_dir.c	11 Jan 2017 07:26:17 -0000	1.8
 +++ t_dir.c	11 Jan 2017 08:59:27 -0000
 @@ -57,7 +57,7 @@
  
  #define	CREAT(x, m)	do {						\
  		int _creat_fd;						\
 -		ATF_REQUIRE_MSG((_creat_fd = creat((x), (m)) != -1),	\
 +		ATF_REQUIRE_MSG((_creat_fd = creat((x), (m))) != -1,	\
  		    "creat(%s, %x) failed: %s", (x), (m),		\
  		    strerror(errno));					\
  		(void)close(_creat_fd);					\
 @@ -91,6 +91,8 @@
  
  	/* get third entry */
  	entry = readdir(dp);
 +	ATF_REQUIRE_MSG(entry != NULL,
 +	    "readdir failed: %s", strerror(errno));
  
  	/* try to return to the position after the first entry */
  	seekdir(dp, here);
 
 --Apple-Mail=_C3310D0C-92A0-4EFF-A753-AAF8944721E1--
 



Home | Main Index | Thread Index | Old Index