FSpOpen: return ioErr if stream is bad

This commit is contained in:
Iliyas Jorio 2022-02-19 20:05:19 +01:00
parent 86d35caf94
commit 66edb10132
1 changed files with 11 additions and 2 deletions

View File

@ -117,13 +117,13 @@ OSErr HostVolume::OpenFork(const FSSpec* spec, ForkType forkType, char permissio
{ {
if (permission == fsCurPerm) if (permission == fsCurPerm)
{ {
TODO2("fsCurPerm not implemented yet"); // TODO: fsCurPerm not implemented yet
return unimpErr; return unimpErr;
} }
if ((permission & fsWrPerm) && forkType != ForkType::DataFork) if ((permission & fsWrPerm) && forkType != ForkType::DataFork)
{ {
TODO2("opening resource fork for writing isn't implemented yet"); // TODO: opening resource fork for writing isn't implemented yet
return unimpErr; return unimpErr;
} }
@ -146,9 +146,18 @@ OSErr HostVolume::OpenFork(const FSSpec* spec, ForkType forkType, char permissio
return fnfErr; return fnfErr;
} }
handle = std::make_unique<HostForkHandle>(ResourceFork, permission, path, *spec); handle = std::make_unique<HostForkHandle>(ResourceFork, permission, path, *spec);
if (!handle->GetStream().good())
{
return ioErr;
}
ADFJumpToResourceFork(handle->GetStream()); ADFJumpToResourceFork(handle->GetStream());
} }
if (!handle->GetStream().good())
{
return ioErr;
}
return noErr; return noErr;
} }