Do not allow renaming to a non-empty directory (#1604)

Found via pjdfstests.  References #1589.
This commit is contained in:
Andrew Gaul 2021-03-28 19:10:52 +09:00 committed by GitHub
parent 9645d57c05
commit 3663082a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1545,6 +1545,9 @@ static int s3fs_rename(const char* _from, const char* _to)
if(0 != (result = get_object_attribute(from, &buf, NULL))){
return result;
}
if(0 != (result = directory_empty(to))){
return result;
}
// flush pending writes if file is open
{ // scope for AutoFdEntity