Date: Mon, 16 Sep 2019 15:56:21 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352414 - head/tests/sys/fs/fusefs Message-ID: <201909161556.x8GFuL3u087536@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Mon Sep 16 15:56:21 2019 New Revision: 352414 URL: https://svnweb.freebsd.org/changeset/base/352414 Log: 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 Modified: head/tests/sys/fs/fusefs/io.cc head/tests/sys/fs/fusefs/mknod.cc Modified: head/tests/sys/fs/fusefs/io.cc ============================================================================== --- head/tests/sys/fs/fusefs/io.cc Mon Sep 16 15:44:59 2019 (r352413) +++ head/tests/sys/fs/fusefs/io.cc Mon Sep 16 15:56:21 2019 (r352414) @@ -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); Modified: head/tests/sys/fs/fusefs/mknod.cc ============================================================================== --- head/tests/sys/fs/fusefs/mknod.cc Mon Sep 16 15:44:59 2019 (r352413) +++ head/tests/sys/fs/fusefs/mknod.cc Mon Sep 16 15:56:21 2019 (r352414) @@ -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"; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909161556.x8GFuL3u087536>