mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 01:08:54 +00:00
Call Rename outside AutoFdEntity scope (#2528)
This avoids a use-after-free in the destructor.
This commit is contained in:
parent
e8f1e3473c
commit
52c10cd45d
@ -1507,11 +1507,10 @@ static int rename_object(const char* from, const char* to, bool update_ctime)
|
|||||||
if(0 != (result = put_headers(to, meta, true, /* use_st_size= */ false))){
|
if(0 != (result = put_headers(to, meta, true, /* use_st_size= */ false))){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rename
|
|
||||||
FdManager::get()->Rename(from, to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FdManager::get()->Rename(from, to);
|
||||||
|
|
||||||
// Remove file
|
// Remove file
|
||||||
result = s3fs_unlink(from);
|
result = s3fs_unlink(from);
|
||||||
|
|
||||||
@ -1562,9 +1561,10 @@ static int rename_object_nocopy(const char* from, const char* to, bool update_ct
|
|||||||
S3FS_PRN_ERR("could not upload file(%s): result=%d", to, result);
|
S3FS_PRN_ERR("could not upload file(%s): result=%d", to, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
FdManager::get()->Rename(from, to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FdManager::get()->Rename(from, to);
|
||||||
|
|
||||||
// Remove file
|
// Remove file
|
||||||
result = s3fs_unlink(from);
|
result = s3fs_unlink(from);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user