]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rados_sync.cc: fix xattr_diff() for the only_in_b checks
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 30 Oct 2014 02:14:41 +0000 (03:14 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 11 Nov 2014 12:26:37 +0000 (13:26 +0100)
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>
src/tools/rados/rados_sync.cc

index 595df81d16699615815980b1b5ba3fcbcd68c45b..4c2ef5edbabeedaf9d58f176c2898c2a2880f29c 100644 (file)
@@ -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);
     }