fusefs: fix some minor Coverity CIDs in the tests

Where open(2) is expected to fail, the tests should assert or expect that
its return value is -1.  These tests all accepted too much but happened to
pass anyway.

Reported by:	Coverity
Coverity CID:	1404512, 1404378, 1404504, 1404483
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Alan Somers 2019-09-16 15:44:59 +00:00
parent 38547d5980
commit 4ca1c0b7f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=352413
3 changed files with 4 additions and 4 deletions

View File

@ -204,7 +204,7 @@ TEST_F(Create, eexist)
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
.WillOnce(Invoke(ReturnErrno(ENOENT)));
expect_create(RELPATH, mode, ReturnErrno(EEXIST));
EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(EEXIST, errno);
}
@ -342,7 +342,7 @@ TEST_F(Create, eperm)
.WillOnce(Invoke(ReturnErrno(ENOENT)));
expect_create(RELPATH, mode, ReturnErrno(EPERM));
EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(EPERM, errno);
}

View File

@ -749,7 +749,7 @@ TEST_F(Open, eacces)
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
EXPECT_NE(0, open(FULLPATH, O_RDWR));
EXPECT_EQ(-1, open(FULLPATH, O_RDWR));
EXPECT_EQ(EACCES, errno);
}

View File

@ -103,7 +103,7 @@ TEST_F(Opendir, eperm)
expect_lookup(RELPATH, ino);
expect_opendir(ino, O_RDONLY, ReturnErrno(EPERM));
EXPECT_NE(0, open(FULLPATH, O_DIRECTORY));
EXPECT_EQ(-1, open(FULLPATH, O_DIRECTORY));
EXPECT_EQ(EPERM, errno);
}