From: Radoslaw Zarzynski Date: Sat, 21 May 2016 00:47:12 +0000 (+0200) Subject: rgw: fix update of already existing account/bucket's custom attributes. X-Git-Tag: v11.0.0~416^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d6129e664fc8d25e70bfaf83e340703005f8f73f;p=ceph.git rgw: fix update of already existing account/bucket's custom attributes. Introduced in: 3f3b18bff16f6a5b36987f888ba3f2a0d1ea3155. Fixes: http://tracker.ceph.com/issues/15977 Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 76a408cdcd2..61256c2cc4c 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1868,7 +1868,9 @@ static void prepare_add_del_attrs(const map& orig_attrs, out_attrs.erase(aiter); } } else { - out_attrs[name] = kv.second; + /* emplace() won't alter the map if the key is already present. + * This behaviour is fully intensional here. */ + out_attrs.emplace(kv); } } else if (out_attrs.find(name) == std::end(out_attrs)) { out_attrs[name] = kv.second;