1
0
Fork 0

dont duplicate handles in psp if filetable is copied (except null-handles)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1042
This commit is contained in:
Ulf Wohlers 2003-06-05 11:03:12 +00:00
parent e18eebf29d
commit cf0b2cbd6c

View file

@ -163,7 +163,8 @@ void DOS_PSP::CopyFileTable(DOS_PSP* srcpsp,bool createchildpsp)
Bit8u handle = srcpsp->GetFileHandle(i);
if(createchildpsp)
{ //copy obeying not inherit flag.(but dont duplicate them)
if(Files[handle] && !(Files[handle]->flags & DOS_NOT_INHERIT) && (FindEntryByHandle(handle)==0xff))
bool allowCopy = (handle==0) || ((handle>0) && (FindEntryByHandle(handle)==0xff));
if(Files[handle] && !(Files[handle]->flags & DOS_NOT_INHERIT) && allowCopy)
{
SetFileHandle(i,handle);
}