]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: fix some incorrect uses of string temporary
authorMatt Benjamin <mbenjamin@redhat.com>
Mon, 14 Dec 2015 20:31:55 +0000 (15:31 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:06:40 +0000 (12:06 -0500)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.cc

index bd65a6bdfda7b1b5892073d8f7eed36f2c0fc0fc..24755a93095d5329e44ebbb9c331992871f6704d 100644 (file)
@@ -314,8 +314,9 @@ int rgw_unlink(struct rgw_fs *rgw_fs, struct rgw_file_handle *parent_fh,
     if (! rc)  {
       /* rgw_fh ref+ */
       RGWFileHandle* rgw_fh = get_rgwfh(fh);
+      std::string oname = rgw_fh->full_object_name();
       RGWDeleteObjRequest req(cct, fs->get_user(), parent->bucket_name(),
-                             rgw_fh->full_object_name());
+                             oname);
       rc = librgw.get_fe()->execute_req(&req);
       /* release */
       (void) rgw_fh_rele(rgw_fs, fh, 0 /* flags */);
@@ -456,11 +457,10 @@ int rgw_getattr(struct rgw_fs *rgw_fs,
     if (rgw_fh->creating())
       goto done;
 
-    const std::string bname = rgw_fh->bucket_name();
-    const std::string oname = rgw_fh->object_name();
+    const std::string& bname = rgw_fh->bucket_name();
+    const std::string& oname = rgw_fh->object_name();
 
-    RGWStatObjRequest req(cct, fs->get_user(),
-                         rgw_fh->bucket_name(), rgw_fh->object_name(),
+    RGWStatObjRequest req(cct, fs->get_user(), bname, oname,
                          RGWStatObjRequest::FLAG_NONE);
 
     int rc = librgw.get_fe()->execute_req(&req);
@@ -641,8 +641,9 @@ int rgw_write(struct rgw_fs *rgw_fs,
     buffer::create_static(length /* XXX size */, static_cast<char*>(buffer)));
 
   /* XXX */
+  std::string oname = rgw_fh->full_object_name();
   RGWPutObjRequest req(cct, fs->get_user(), rgw_fh->bucket_name(),
-                      rgw_fh->full_object_name(), bl);
+                      oname, bl);
 
   int rc = librgw.get_fe()->execute_req(&req);
 
@@ -752,8 +753,9 @@ int rgw_readv(struct rgw_fs *rgw_fs,
                            static_cast<char*>(vio->vio_base)));
   }
 
+  std::string oname = rgw_fh->full_object_name();
   RGWPutObjRequest req(cct, fs->get_user(), rgw_fh->bucket_name(),
-                      rgw_fh->full_object_name(), bl);
+                      oname, bl);
 
   int rc = librgw.get_fe()->execute_req(&req);