diff --git a/src/pool/PoolSQL.cc b/src/pool/PoolSQL.cc index f763dd2b38..0d167e2d4f 100644 --- a/src/pool/PoolSQL.cc +++ b/src/pool/PoolSQL.cc @@ -356,7 +356,11 @@ void PoolSQL::update_cache_index(string& old_name, if ( index != name_pool.end() ) { name_pool.erase(old_key); - name_pool.insert(make_pair(new_key, index->second)); + + if ( name_pool.find(new_key) == name_pool.end()) + { + name_pool.insert(make_pair(new_key, index->second)); + } } unlock(); diff --git a/src/rm/RequestManagerChown.cc b/src/rm/RequestManagerChown.cc index e1563dfd83..4ecbf9ee48 100644 --- a/src/rm/RequestManagerChown.cc +++ b/src/rm/RequestManagerChown.cc @@ -69,6 +69,9 @@ void RequestManagerChown::request_execute(xmlrpc_c::paramList const& paramList, PoolObjectSQL * object; + string obj_name; + int old_uid; + // ------------- Check new user and group id's --------------------- if ( noid > -1 ) @@ -138,12 +141,11 @@ void RequestManagerChown::request_execute(xmlrpc_c::paramList const& paramList, if ( noid != -1 ) { - string obj_name = object->get_name(); - int old_uid = object->get_uid(); + obj_name = object->get_name(); + old_uid = object->get_uid(); object->set_user(noid,nuname); - pool->update_cache_index(obj_name, old_uid, obj_name, noid); } if ( ngid != -1 ) @@ -155,6 +157,11 @@ void RequestManagerChown::request_execute(xmlrpc_c::paramList const& paramList, object->unlock(); + if ( noid != -1 ) + { + pool->update_cache_index(obj_name, old_uid, obj_name, noid); + } + success_response(oid, att); return;