]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: svc.bucket: move _orig_info out of "if" block
authorKefu Chai <kchai@redhat.com>
Fri, 27 Dec 2019 03:33:37 +0000 (11:33 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 27 Dec 2019 03:36:05 +0000 (11:36 +0800)
so `*orig_info` is valid out of the `if` block if it's set to
`&_orig_info`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/services/svc_bucket_sobj.cc

index 2d27f1a4903e7358e014e1bf6e75f4e955f3570c..66088873c07d191284c088f8a75a40250950cfa0 100644 (file)
@@ -488,18 +488,16 @@ int RGWSI_Bucket_SObj::store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
   /*
    * we might need some special handling if overwriting
    */
-
+  RGWBucketInfo shared_bucket_info;
   if (!orig_info && !exclusive) {  /* if exclusive, we're going to fail when try
                                       to overwrite, so the whole check here is moot */
-    /* we're here because orig_info wasn't passed in */
-    RGWBucketInfo _orig_info;
-
     /*
+     * we're here because orig_info wasn't passed in
      * we don't have info about what was there before, so need to fetch first
      */
     int r  = read_bucket_instance_info(ctx,
                                        key,
-                                       &_orig_info,
+                                       &shared_bucket_info,
                                        nullptr, nullptr,
                                        y,
                                        nullptr, boost::none);
@@ -509,7 +507,7 @@ int RGWSI_Bucket_SObj::store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
         return r;
       }
     } else {
-      *orig_info = &_orig_info;
+      *orig_info = &shared_bucket_info;
     }
   }