aboutsummaryrefslogtreecommitdiff
path: root/tests/sys
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2019-09-16 15:56:21 +0000
committerAlan Somers <asomers@FreeBSD.org>2019-09-16 15:56:21 +0000
commit9c9634d1db94aa8e0fe8460af8c65f0fd4259a2e (patch)
tree34821dabc7a4320142d9501e84e6d61a12eede4d /tests/sys
parent4ca1c0b7f7ea107f0a0e6177520333b02241b847 (diff)
downloadsrc-9c9634d1db94aa8e0fe8460af8c65f0fd4259a2e.tar.gz
src-9c9634d1db94aa8e0fe8460af8c65f0fd4259a2e.zip
fusefs: initialize C++ classes the Coverity way
Coverity complained that I wasn't initializing some class members until the SetUp method. Do it in the constructor instead. Reported by: Coverity Coverity CIDs: 1404352, 1404378 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=352414
Diffstat (limited to 'tests/sys')
-rw-r--r--tests/sys/fs/fusefs/io.cc4
-rw-r--r--tests/sys/fs/fusefs/mknod.cc5
2 files changed, 6 insertions, 3 deletions
diff --git a/tests/sys/fs/fusefs/io.cc b/tests/sys/fs/fusefs/io.cc
index 135fc4c9194b..5fefdc5307d7 100644
--- a/tests/sys/fs/fusefs/io.cc
+++ b/tests/sys/fs/fusefs/io.cc
@@ -108,11 +108,11 @@ int m_backing_fd, m_control_fd, m_test_fd;
off_t m_filesize;
bool m_direct_io;
-Io(): m_backing_fd(-1), m_control_fd(-1), m_test_fd(-1), m_direct_io(false) {};
+Io(): m_backing_fd(-1), m_control_fd(-1), m_test_fd(-1), m_filesize(0),
+ m_direct_io(false) {};
void SetUp()
{
- m_filesize = 0;
m_backing_fd = open("backing_file", O_RDWR | O_CREAT | O_TRUNC, 0644);
if (m_backing_fd < 0)
FAIL() << strerror(errno);
diff --git a/tests/sys/fs/fusefs/mknod.cc b/tests/sys/fs/fusefs/mknod.cc
index 53087b75d987..5e16472cbe90 100644
--- a/tests/sys/fs/fusefs/mknod.cc
+++ b/tests/sys/fs/fusefs/mknod.cc
@@ -55,8 +55,11 @@ const static mode_t c_umask = 022;
public:
-virtual void SetUp() {
+Mknod() {
m_oldmask = umask(c_umask);
+}
+
+virtual void SetUp() {
if (geteuid() != 0) {
GTEST_SKIP() << "Only root may use most mknod(2) variations";
}