[ox/fs] Fix duplication of dir entries on update of file

This commit is contained in:
Gary Talent 2022-01-28 19:44:20 -06:00
parent 2be5b0f6bc
commit f10373864d
2 changed files with 2 additions and 3 deletions

View File

@ -240,7 +240,6 @@ Error Directory<FileStore, InodeId_t>::write(PathIterator path, InodeId_t inode,
return OxError(1, "Could not allocate memory for copy of Directory"); return OxError(1, "Could not allocate memory for copy of Directory");
} }
// TODO: look for old version of this entry and delete it
oxReturnError(cpy->setSize(newSize)); oxReturnError(cpy->setSize(newSize));
auto val = cpy->malloc(entryDataSize).value; auto val = cpy->malloc(entryDataSize).value;
if (!val.valid()) { if (!val.valid()) {

View File

@ -333,9 +333,9 @@ Error FileSystemTemplate<FileStore, Directory>::write(const char *path, const vo
if (err) { if (err) {
oxRequire(generatedId, m_fs.generateInodeId()); oxRequire(generatedId, m_fs.generateInodeId());
inode = generatedId; inode = generatedId;
}
oxRequireM(rootDir, this->rootDir()); oxRequireM(rootDir, this->rootDir());
oxReturnError(rootDir.write(path, inode)); oxReturnError(rootDir.write(path, inode));
}
oxReturnError(write(inode, buffer, size, fileType)); oxReturnError(write(inode, buffer, size, fileType));
return OxError(0); return OxError(0);
} }