From fe7bf06366adaf787816d1e68f5e3f68e8c91134 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 4 Nov 2014 22:05:03 -0800 Subject: [PATCH] rgw: RGWRados::get_obj() returns wrong len if len == 0 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 --- src/rgw/rgw_rados.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 1d05509d6c8bf..709b8020d4dab 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4689,7 +4689,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)) { -- 2.39.5