Skip to content

Commit e590d42

Browse files
committed
rados_sync.cc: fix xattr_diff() for the only_in_b checks
In the checks to build only_in_b up the wrong const_iterator x is build up. it should compare rhs->xattrs with xattrs entries and not twice rhs->xattrs. Fix for: CID 716957 (#1 of 1): Invalid iterator comparison (MISMATCHED_ITERATOR) mismatched_comparison: Comparing x from rhs->xattrs to this->xattrs.end() from this->xattrs. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
1 parent 04517f0 commit e590d42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tools/rados/rados_sync.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ void BackedUpObject::xattr_diff(const BackedUpObject *rhs,
504504
only_in_a.clear();
505505
only_in_b.clear();
506506
diff.clear();
507+
507508
for (std::map < std::string, Xattr* >::const_iterator x = xattrs.begin();
508509
x != xattrs.end(); ++x)
509510
{
@@ -518,10 +519,11 @@ void BackedUpObject::xattr_diff(const BackedUpObject *rhs,
518519
diff.push_back(x->first);
519520
}
520521
}
522+
521523
for (std::map < std::string, Xattr* >::const_iterator r = rhs->xattrs.begin();
522524
r != rhs->xattrs.end(); ++r)
523525
{
524-
std::map < std::string, Xattr* >::const_iterator x = rhs->xattrs.find(r->first);
526+
std::map < std::string, Xattr* >::const_iterator x = xattrs.find(r->first);
525527
if (x == xattrs.end()) {
526528
only_in_b.push_back(r->first);
527529
}

0 commit comments

Comments
 (0)