From d6129e664fc8d25e70bfaf83e340703005f8f73f Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Sat, 21 May 2016 02:47:12 +0200 Subject: [PATCH] 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 --- src/rgw/rgw_op.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 76a408cdcd203..61256c2cc4c03 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; -- 2.39.5