]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix ReplicatedPG do_xattr_cmp_u64 3545/head
authorDongmao Zhang <deanraccoon@gmail.com>
Fri, 30 Jan 2015 03:20:50 +0000 (11:20 +0800)
committerDongmao Zhang <deanraccoon@gmail.com>
Fri, 30 Jan 2015 03:20:50 +0000 (11:20 +0800)
1. bufferlist.c_str() will return a string which is longer than its real length.
This could cause an error result from do_xattr_cmp_u64. So use
std::string to receive the xattr
2. s/atoll/strtoull

Signed-off-by: Dongmao Zhang <deanraccoon@gmail.com>
src/osd/ReplicatedPG.cc

index 30638cc7608d9d21f3bf73f84b389a83e4463015..42bf87ea80f2b29e3129c6790b64be88a21aeff2 100644 (file)
@@ -3009,8 +3009,10 @@ void ReplicatedPG::snap_trimmer()
 int ReplicatedPG::do_xattr_cmp_u64(int op, __u64 v1, bufferlist& xattr)
 {
   __u64 v2;
-  if (xattr.length())
-    v2 = atoll(xattr.c_str());
+
+  string v2s(xattr.c_str(), xattr.length());
+  if (v2s.length())
+    v2 = strtoull(v2s.c_str(), NULL, 10);
   else
     v2 = 0;