From 08d5a283df1c5723e0ac0492609037bb9c85e11b Mon Sep 17 00:00:00 2001 From: Jan Harkes Date: Thu, 7 Mar 2013 22:10:42 -0500 Subject: [PATCH] Avoid sending a success response when an error occurs. Functions called from RGWGetObj_ObjStore_S3::send_response_data may change the value of the non-local variable 'ret'. But the response relies on a local 'req_state' which copies ret at the start of the function. Right now none of the called functions actually changes ret so the problem doesn't trigger, but to avoid future breakage it is safer to not rely on the (early) copy of the ret variable. Signed-off-by: Jan Harkes --- src/rgw/rgw_rest_s3.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 16ac4000436..9e0c336fb6d 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -71,7 +71,6 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, off_ { const char *content_type = NULL; string content_type_str; - int req_state = ret; map response_attrs; map::iterator riter; @@ -131,10 +130,8 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, off_ } } - if (partial_content && !ret) - req_state = STATUS_PARTIAL_CONTENT; done: - set_req_state_err(s, req_state); + set_req_state_err(s, (partial_content && !ret) ? STATUS_PARTIAL_CONTENT : ret); dump_errno(s); -- 2.47.3