Remove unneeded uses of std::map::operator[] (#2642)

These unintentionally mutate the map.  Script suggested by @danmar.
This commit is contained in:
Andrew Gaul
2025-02-08 18:21:44 -08:00
committed by GitHub
parent edf4141ad6
commit dc92b1b087
4 changed files with 70 additions and 7 deletions

View File

@ -4004,8 +4004,9 @@ static int s3fs_removexattr(const char* path, const char* name)
}
if(need_put_header){
// not found opened file.
if(updatemeta["x-amz-meta-xattr"].empty()){
updatemeta.erase("x-amz-meta-xattr");
auto iter = updatemeta.find("x-amz-meta-xattr");
if(iter != updatemeta.end() && iter->second.empty()){
updatemeta.erase(iter);
}
merge_headers(meta, updatemeta, true);