]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth/AuthMethodList.cc: fix remove_supported_auth()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 18 Mar 2013 13:08:22 +0000 (14:08 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 18 Mar 2013 13:08:22 +0000 (14:08 +0100)
Make sure the iterator isn't incremented twice if a element gets erased.
Move increment out of the for-loop header and add it to a new else block.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/auth/AuthMethodList.cc

index e345e150549efafd741cf5bec246c35b0fa5ddee..50d58bff4d49637adb6369f5f17e5d32c6bbcff0 100644 (file)
@@ -59,8 +59,10 @@ int AuthMethodList::pick(const std::set<__u32>& supported)
 
 void AuthMethodList::remove_supported_auth(int auth_type)
 {
-  for (list<__u32>::iterator p = auth_supported.begin(); p != auth_supported.end(); ++p) {
+  for (list<__u32>::iterator p = auth_supported.begin(); p != auth_supported.end(); ) {
     if (*p == (__u32)auth_type)
       auth_supported.erase(p++);
+    else 
+      ++p;
   }
 }