]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWRados::get_obj() returns wrong len if len == 0
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 5 Nov 2014 06:05:03 +0000 (22:05 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 14 Jan 2015 23:51:44 +0000 (15:51 -0800)
Fixes: #9877
We only updated if len was > 0, should update it if r >= 0. This was the
culprit for issue #9877.
Backport: giant, firefly

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit fe7bf06366adaf787816d1e68f5e3f68e8c91134)

src/rgw/rgw_rados.cc

index eb9bf99e0668b9fdd7932a4f01c17ac7565d8416..139a3d498e120ce1e2ce3d8ec7b3f3cd6698d8f4 100644 (file)
@@ -4665,7 +4665,7 @@ int RGWRados::get_obj(void *ctx, RGWObjVersionTracker *objv_tracker, void **hand
     bl.append(read_bl);
 
 done:
-  if (bl.length() > 0) {
+  if (r >= 0) {
     r = bl.length();
   }
   if (r < 0 || !len || ((off_t)(ofs + len - 1) == end)) {