Don't write to a read-only file

This commit is contained in:
Alex Barney 2020-03-22 17:52:27 -07:00
parent 8ead72ed84
commit 95ef1c9529

View file

@ -190,6 +190,16 @@ namespace LibHac.FsService.Impl
rc = _fileSystem.OpenFile(out contextFile, ContextFileName, OpenMode.Read);
if (rc.IsFailure()) return rc;
}
}
finally
{
contextFile?.Dispose();
}
try
{
Result rc = _fileSystem.OpenFile(out contextFile, ContextFileName, OpenMode.ReadWrite);
if (rc.IsFailure()) return rc;
_context.Version = CurrentContextVersion;
_context.State = CommitState.NotCommitted;