Skip to content

Commit a4cecda

Browse files
committed
test/librados/c_read_operations.cc: fix invalid checks
Wrong variable for return of rados_getxattrs_next() and rados_omap_get_next() used (len vs. val_len). Fix for: CID 1219464 (#1 of 1): Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this expression key == NULL inside statement if (len == 0UL && key == NU... CID 1219465 (#1 of 1): Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this expression key == NULL inside statement if (len == 0UL && key == NU... Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
1 parent 97ed2ae commit a4cecda

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/test/librados/c_read_operations.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CReadOpsTest : public RadosTest {
7070
size_t val_len = 0;
7171
while (i < len) {
7272
ASSERT_EQ(0, rados_omap_get_next(iter, &key, &val, &val_len));
73-
if (len == 0 && key == NULL && val == NULL)
73+
if (val_len == 0 && key == NULL && val == NULL)
7474
break;
7575
if (key)
7676
EXPECT_EQ(std::string(keys[i]), std::string(key));
@@ -101,7 +101,7 @@ class CReadOpsTest : public RadosTest {
101101
while (i < len) {
102102
ASSERT_EQ(0, rados_getxattrs_next(iter, (const char**) &key,
103103
(const char**) &val, &val_len));
104-
if (len == 0 && key == NULL && val == NULL)
104+
if (val_len == 0 && key == NULL && val == NULL)
105105
break;
106106
EXPECT_EQ(std::string(keys[i]), std::string(key));
107107
EXPECT_EQ(0, memcmp(vals[i], val, val_len));

0 commit comments

Comments
 (0)