Fail early on actual rename

This commit is contained in:
Willy-JL
2023-05-26 22:05:43 +01:00
parent 52ee61968b
commit 20dd1ba9da

View File

@@ -428,6 +428,10 @@ bool storage_is_subdir(const char* a, const char* b) {
} }
FS_Error storage_common_rename(Storage* storage, const char* old_path, const char* new_path) { FS_Error storage_common_rename(Storage* storage, const char* old_path, const char* new_path) {
if(!storage_common_exists(storage, old_path)) {
return FSE_NOT_EXIST;
}
if(storage_is_subdir(new_path, old_path)) { if(storage_is_subdir(new_path, old_path)) {
return FSE_INVALID_NAME; return FSE_INVALID_NAME;
} }