From 86a8e9c2d24c12a12db5a5541dbf69da26143524 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sun, 23 May 2004 20:06:51 +0000 Subject: [PATCH] This was unequal replacement: in new code performed more memory access git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@951 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/newstuff.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/newstuff.c b/kernel/newstuff.c index 1afb7da..bc73c9c 100644 --- a/kernel/newstuff.c +++ b/kernel/newstuff.c @@ -39,7 +39,7 @@ static BYTE *mainRcsId = */ int SetJFTSize(UWORD nHandles) { - UWORD block, maxBlock; + UWORD block, maxBlock, i; psp FAR *ppsp = MK_FP(cu_psp, 0); UBYTE FAR *newtab; @@ -56,8 +56,10 @@ int SetJFTSize(UWORD nHandles) ++block; newtab = MK_FP(block, 0); - fmemset(newtab, 0xff, nHandles); - fmemcpy(newtab, ppsp->ps_filetab, ppsp->ps_maxfiles); + i = ppsp->ps_maxfiles; + /* copy existing part and fill up new part by "no open file" */ + fmemcpy(newtab, ppsp->ps_filetab, i); + fmemset(newtab + i, 0xff, nHandles - i); ppsp->ps_maxfiles = nHandles; ppsp->ps_filetab = newtab;