]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: get_pool_name() should not return ref of a local variable 9595/head
authorKefu Chai <kchai@redhat.com>
Wed, 8 Jun 2016 16:04:44 +0000 (00:04 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 8 Jun 2016 16:11:43 +0000 (00:11 +0800)
was introduced by 1a44e6f

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/include/rados/librados.hpp
src/librados/IoCtxImpl.cc
src/librados/IoCtxImpl.h
src/librados/librados.cc

index ece7cc516b8029a393fc322e6bdb4ddd0dbec191..ffbc58198e072ddfabe348dff0afa6f01a952c7f 100644 (file)
@@ -1120,7 +1120,7 @@ namespace librados
     int cache_pin(const std::string& o);
     int cache_unpin(const std::string& o);
 
-    const std::string& get_pool_name() const;
+    std::string get_pool_name() const;
 
     void locator_set_key(const std::string& key);
     void set_namespace(const std::string& nspace);
index 7cc2799bac2fcef129aec3333573e0bf986bf301..1b29d1eeea87894960c6ad2f558da702d19a5bbd 100644 (file)
@@ -316,11 +316,10 @@ void librados::IoCtxImpl::flush_aio_writes()
   aio_write_list_lock.Unlock();
 }
 
-const string& librados::IoCtxImpl::get_cached_pool_name()
+string librados::IoCtxImpl::get_cached_pool_name()
 {
   std::string pn;
   client->pool_get_name(get_id(), &pn);
-
   return pn;
 }
 
index 5cc300e3ff83a9f86b846417e589471958a56d06..19fd0b5b6b7e7366812acc3ff7ba6e6ce4ece77a 100644 (file)
@@ -87,7 +87,7 @@ struct librados::IoCtxImpl {
     return poolid;
   }
 
-  const string& get_cached_pool_name();
+  string get_cached_pool_name();
 
   int get_object_hash_position(const std::string& oid, uint32_t *hash_postion);
   int get_object_pg_hash_position(const std::string& oid, uint32_t *pg_hash_position);
index 7fe1239c39f13663f050762e1ca5929a9c7aa788..018e53f76e1eecd65e6bb0e220cd44e1d873faab 100644 (file)
@@ -1159,7 +1159,7 @@ std::string librados::IoCtx::get_pool_name()
   return s;
 }
 
-const std::string& librados::IoCtx::get_pool_name() const
+std::string librados::IoCtx::get_pool_name() const
 {
   return io_ctx_impl->get_cached_pool_name();
 }