From: Danny Al-Gaaf Date: Thu, 30 Oct 2014 02:14:41 +0000 (+0100) Subject: rados_sync.cc: fix xattr_diff() for the only_in_b checks X-Git-Tag: v0.89~22^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e590d42c900ea79fb008883e2298495cafa61e34;p=ceph.git 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 --- diff --git a/src/tools/rados/rados_sync.cc b/src/tools/rados/rados_sync.cc index 595df81d1669..4c2ef5edbabe 100644 --- a/src/tools/rados/rados_sync.cc +++ b/src/tools/rados/rados_sync.cc @@ -504,6 +504,7 @@ void BackedUpObject::xattr_diff(const BackedUpObject *rhs, only_in_a.clear(); only_in_b.clear(); diff.clear(); + for (std::map < std::string, Xattr* >::const_iterator x = xattrs.begin(); x != xattrs.end(); ++x) { @@ -518,10 +519,11 @@ void BackedUpObject::xattr_diff(const BackedUpObject *rhs, diff.push_back(x->first); } } + for (std::map < std::string, Xattr* >::const_iterator r = rhs->xattrs.begin(); r != rhs->xattrs.end(); ++r) { - std::map < std::string, Xattr* >::const_iterator x = rhs->xattrs.find(r->first); + std::map < std::string, Xattr* >::const_iterator x = xattrs.find(r->first); if (x == xattrs.end()) { only_in_b.push_back(r->first); }