From 9077446685e21383f45facc005bcc4f21b1ec3ca Mon Sep 17 00:00:00 2001 From: jmcmullan Date: Wed, 29 Jan 2014 19:36:35 +0000 Subject: [PATCH] dos.library: Attempt to fix bogus matches against DosType=0 Signed-off-by: Jason S. McMullan git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@48785 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/dos/cliinit.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/rom/dos/cliinit.c b/rom/dos/cliinit.c index b4d30665f8..fa0be4c9b7 100644 --- a/rom/dos/cliinit.c +++ b/rom/dos/cliinit.c @@ -176,15 +176,35 @@ static long internalBootCliHandler(void); AROS_LIBFUNC_EXIT } /* CliInit */ -/* Find the most recent version of the matching filesystem */ -static struct FileSysEntry *internalMatchFileSystemResourceHandler(struct FileSysResource *fsr, ULONG DosType) +/* Find the most recent version of the matching filesystem + * We are assured from the calling function that either + * DosType != 0, or Handler != BNULL. + * We attempt to match first on DosType, then on Handler. + */ +static struct FileSysEntry *internalMatchFileSystemResourceHandler(struct FileSysResource *fsr, ULONG DosType, BPTR Handler) { struct FileSysEntry *fse, *best_fse = NULL; ForeachNode(&fsr->fsr_FileSysEntries, fse) { - if (fse->fse_DosType == DosType) + BOOL try_patch = FALSE; + + if (DosType == 0) + { + if (fse->fse_Handler != BNULL && + (fse->fse_PatchFlags & FSEF_HANDLER)) + { + try_patch = (strcmp(AROS_BSTR_ADDR(Handler), + AROS_BSTR_ADDR(fse->fse_Handler)) == 0) + ? TRUE : FALSE; + } + } + else if (fse->fse_DosType == DosType) { + try_patch = TRUE; + } + + if (try_patch) { if (fse->fse_PatchFlags & (FSEF_HANDLER | FSEF_SEGLIST | FSEF_TASK)) { if (best_fse == NULL || fse->fse_Version > best_fse->fse_Version) @@ -250,7 +270,7 @@ static void internalPatchBootNode(struct FileSysResource *fsr, struct DeviceNode /* * internalMatchFileSystemResourceHandler looks up the filesystem */ - fse = internalMatchFileSystemResourceHandler(fsr, de->de_DosType); + fse = internalMatchFileSystemResourceHandler(fsr, de->de_DosType, dn->dn_Handler); if (fse != NULL) { D(bug("Dos/CliInit: found 0x%p in FileSystem.resource\n", fse)); -- 2.11.4.GIT