AP_Filesystem: Don't try and rename between backends

This commit is contained in:
Iampete1 2025-01-04 18:24:49 +00:00 committed by Peter Barker
parent c7228419ef
commit 78d9e5a875

View File

@ -192,8 +192,17 @@ int AP_Filesystem::mkdir(const char *pathname)
int AP_Filesystem::rename(const char *oldpath, const char *newpath)
{
const Backend &backend = backend_by_path(oldpath);
return backend.fs.rename(oldpath, newpath);
const Backend &oldbackend = backend_by_path(oldpath);
// Don't need the backend again, but we also need to remove the backend pre-fix from the new path.
const Backend &newbackend = backend_by_path(newpath);
// Don't try and rename between backends.
if (&oldbackend != &newbackend) {
return -1;
}
return oldbackend.fs.rename(oldpath, newpath);
}
AP_Filesystem::DirHandle *AP_Filesystem::opendir(const char *pathname)