On Tue, 16 Mar 2004, Luchezar Georgiev wrote:

> >>> Run "DEBUG<T.D>RESULT".

> Damn, you're right! :-( It's the same with 4DOS! Moreover, the redirected
> file actually DOES contain the data but it's probably not properly closed,
> because after this operation, CHKDSK says that the disk has one lost
> cluster, which after being recovered to FILE0000.CHK, DOES contain the
> DEBUG output! Redirection works with other programs I tried, but not with
> DEBUG!

It looks like a bug in both DEBUG and the kernel.
What happens is the reference count in the SFT gets too high.
1. open: 1
2. int21/ax=4b: 2
3. int21/ax=55: 3 (this function called by debug)

then:
4. int20: 2
5. int21/ah= 3e: 1
... and the file still isn't really closed

If you do the redirection again then it will use new sft entries.
Just do the above a couple of times and you'll see that opening a file
gives an sft idx entry in the PSP that is higher and higher...
in other words, leaked file handles...

It doesn't hurt to commit (sync) the file though so with the patch below
the problem is "solved".

> And this is so for both MS-DOS DEBUG and FreeDOS DEBUG, as it seems
>  from your and my tests...

That's strange. Then MS-DOS DEBUG would also leak handles...

Bart

Index: dosfns.c
===================================================================
RCS file: /cvsroot/freedos/kernel/kernel/dosfns.c,v
retrieving revision 1.58
diff -u -r1.58 dosfns.c
--- dosfns.c    7 Mar 2004 12:59:37 -0000       1.58
+++ dosfns.c    17 Mar 2004 13:18:22 -0000
@@ -749,11 +749,8 @@
     }
     return SUCCESS;
   }
-  if (commitonly)
+  if (commitonly || sftp->sft_count > 0)
     return dos_commit(sftp->sft_status);
-
-  if (sftp->sft_count > 0)
-    return SUCCESS;

 /* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***.  - Ron Cemer */
   if (IsShareInstalled())






-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to