From cee5f26293af4763fc1267ab28199c4dc4654e03 Mon Sep 17 00:00:00 2001 From: Daniel Gryniewicz Date: Wed, 1 Oct 2025 13:08:22 -0400 Subject: [PATCH] RGW - Posix Test - initialize "existed" bools Theoretically, the "existed" bools in the test could have had junk in them. Since the driver only writes to them when writing "true", this could have had a false positive return. Initialize them all. Fixes: https://tracker.ceph.com/issues/73327 Signed-off-by: Daniel Gryniewicz --- src/test/rgw/test_rgw_posix_driver.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/rgw/test_rgw_posix_driver.cc b/src/test/rgw/test_rgw_posix_driver.cc index a8b0f9bb348fc..4b4b02a497815 100644 --- a/src/test/rgw/test_rgw_posix_driver.cc +++ b/src/test/rgw/test_rgw_posix_driver.cc @@ -148,7 +148,7 @@ TEST(FSEnt, DirCreate) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testdir->create(env->dpp, &existed); EXPECT_EQ(ret, 0); @@ -165,7 +165,7 @@ TEST(FSEnt, DirBase) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testdir->create(env->dpp, &existed); EXPECT_EQ(ret, 0); @@ -280,7 +280,7 @@ TEST(FSEnt, DirBase) TEST(FSEnt, DirAddDir) { - bool existed; + bool existed{false}; std::string dirname = get_test_name(); sf::path tp{base_path / dirname}; std::unique_ptr testdir = std::make_unique(dirname, root.get(), env->cct.get()); @@ -314,7 +314,7 @@ TEST(FSEnt, DirAddDir) TEST(FSEnt, DirRename) { - bool existed; + bool existed{false}; std::string dirname = get_test_name(); sf::path tp{base_path / dirname}; std::unique_ptr testdir = std::make_unique(dirname, root.get(), env->cct.get()); @@ -357,7 +357,7 @@ TEST(FSEnt, FileCreateReal) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testfile.create(env->dpp, &existed); EXPECT_EQ(ret, 0); @@ -374,7 +374,7 @@ TEST(FSEnt, FileCreateTemp) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testfile.create(env->dpp, &existed, true); EXPECT_EQ(ret, 0); EXPECT_FALSE(existed); @@ -396,7 +396,7 @@ TEST(FSEnt, FileBase) EXPECT_FALSE(sf::exists(tp)); EXPECT_EQ(testfile->get_fd(), -1); - bool existed; + bool existed{false}; int ret = testfile->create(env->dpp, &existed); EXPECT_EQ(ret, 0); @@ -530,7 +530,7 @@ TEST(FSEnt, SymlinkBase) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testlink->create(env->dpp, &existed); EXPECT_EQ(ret, 0); @@ -562,7 +562,7 @@ TEST(FSEnt, MPDirBase) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testdir->create(env->dpp, &existed); EXPECT_EQ(ret, 0); @@ -680,7 +680,7 @@ TEST(FSEnt, MPDirTemp) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testdir->create(env->dpp, &existed, true); EXPECT_EQ(ret, 0); @@ -771,7 +771,7 @@ TEST(FSEnt, VerDirBase) EXPECT_FALSE(sf::exists(tp)); - bool existed; + bool existed{false}; int ret = testdir->create(env->dpp, &existed); EXPECT_EQ(ret, 0); -- 2.39.5