Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2017 07:17:03 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311917 - head/contrib/netbsd-tests/lib/libc/gen
Message-ID:  <201701110717.v0B7H30W031630@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Jan 11 07:17:03 2017
New Revision: 311917
URL: https://svnweb.freebsd.org/changeset/base/311917

Log:
  Fix up r311227
  
  Check for creat returning a value != -1, not a non-zero value
  
  MFC after:	3 days
  Pointyhat to:	ngie
  Reported by:	Coverity
  CID:		1368366

Modified:
  head/contrib/netbsd-tests/lib/libc/gen/t_dir.c

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_dir.c	Wed Jan 11 06:01:23 2017	(r311916)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_dir.c	Wed Jan 11 07:17:03 2017	(r311917)
@@ -59,12 +59,12 @@ ATF_TC_BODY(seekdir_basic, tc)
 	long here;
 
 #ifdef	__FreeBSD__
-#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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701110717.v0B7H30W031630>