From 85603ac5eb3ca5ca4f0a59f8ca2b5f424cd9fba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Wed, 23 Aug 2006 20:09:52 +0000 Subject: [PATCH] fix odd situation where searchslot overrunning was not detected (see sf bug #1543663) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2691 --- src/dos/drive_cache.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index adff3b51..056731be 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_cache.cpp,v 1.47 2006-04-10 12:52:47 qbix79 Exp $ */ +/* $Id: drive_cache.cpp,v 1.48 2006-08-23 20:09:52 c2woody Exp $ */ #include "drives.h" #include "dos_inc.h" @@ -690,11 +690,13 @@ bool DOS_Drive_Cache::SetResult(CFileInfo* dir, char* &result, Bit16u entryNr) bool DOS_Drive_Cache::FindFirst(char* path, Bitu& id) { Bit16u dirID; - Bitu dirFindFirstID = this->nextFreeFindFirst++; //increase it for the next search + Bitu dirFindFirstID = this->nextFreeFindFirst; // Cache directory in if (!OpenDir(path,dirID)) return false; + this->nextFreeFindFirst++; //increase it for the next search + if (dirFindFirstID == MAX_OPENDIRS) { // no free slot found... LOG(LOG_MISC,LOG_ERROR)("DIRCACHE: FindFirst/Next: All slots full. Resetting");