Chaged codes about iterator

This commit is contained in:
Takeshi Nakatani 2015-06-13 03:08:56 +00:00
parent 84fb3d83d8
commit 0ecf4aa6b4

View File

@ -3119,24 +3119,26 @@ static int s3fs_removexattr(const char* path, const char* name)
} }
// get xattrs // get xattrs
if(meta.end() == meta.find("x-amz-meta-xattr")){ headers_t::iterator hiter = meta.find("x-amz-meta-xattr");
if(meta.end() == hiter){
// object does not have xattrs // object does not have xattrs
return -ENOATTR; return -ENOATTR;
} }
string strxattrs = meta["x-amz-meta-xattr"]; string strxattrs = hiter->second;
parse_xattrs(strxattrs, xattrs); parse_xattrs(strxattrs, xattrs);
// check name xattrs // check name xattrs
string strname = name; string strname = name;
if(xattrs.end() == xattrs.find(strname)){ xattrs_t::iterator xiter = xattrs.find(strname);
if(xattrs.end() == xiter){
free_xattrs(xattrs); free_xattrs(xattrs);
return -ENOATTR; return -ENOATTR;
} }
// make new header_t after deleting name xattr // make new header_t after deleting name xattr
if(xattrs[strname]){ if(xiter->second){
delete xattrs[strname]; delete xiter->second;
} }
xattrs.erase(strname); xattrs.erase(strname);