ELVIS WARNING - LOST CLUSTERS ON PC's

Norbert Bladt nbladt at aut.UUCP
Fri Aug 31 16:59:53 AEST 1990


tjr at cbnewsc.att.com (thomas.j.roberts) writes:

>Following up to my previous posting on successfully building elvis:

>BEWARE! elvis is NOT cleaning up properly - it leaves LOST CLUSTERS
>on the temp disk. In my case this is a RAMDISK, and I did not check
>it after initially playing with elvis. elvis appears to work fine -
>I have used most of its commands, and it appears to be a VERY faithful
>clone of vi. I have no idea why it creates lost clusters in the
>temp disk, but that makes it HIGHLY SUSPECT. Others have reported
>similar problems using Quick C (I used Turbo C).  Good Luck!

I had the same problem with a program ported from UNIX to MS-DOS.
On UNIX (every flavour) it is possible to do the following (this
may not be correct on UNIX, just to give you the idea what happens,
no runtime checks included):


	char *TmpFileName, mktemp();
	FILE TmpFile, fopen();

		/* Create a unique name for temp. file */
	TmpFileName = mktemp ("/tmp/pipapoXXXXXX");

		/* open temp. file */
	TmpFile = fopen (TmpFileName, "r+");

	unlink (TmpFileName);	/* delete temporary file.
				   However, it is NOT deleted,
				   because it has been opened by
				   an application, i.e. this program !
				*/

	/* Do the usual fread and fwrite operations here */

	exit();	/* this will close and delete the temporary file */

If you do this on MS-DOS it will create lost clusters.
On VMS it simply doesn't work (error reported by unlink).
If you ignore the error code of the unlink (which most programs do :-( )
the temporary file is still existing after your application did exit.
Since it is the temp disk you are having problems with, this rang a bell
in me.

Perhaps this part of the code is wrong in that way. I had a lot of problems
with this programming style on MS-DOS and VMS.

I have saved the elvis code but did not yet take a look at it. My comments
are just a guess, though.

>Tom Roberts
Norbert Bladt.
-- 
Please use this path as return address. DON'T USE THE RETURN PATH IN THE HEADER
Norbert Bladt, Ascom Autelca AG, Worbstr. 201, CH-3073 Guemligen, Switzerland
Phone: +41 31 52 92 14
EMail: ..!uunet!mcsun!chx400!hslrswi!bladt



More information about the Alt.sources mailing list