From: Richard Dawe Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP's filesystem extension Date: Thu, 20 Jul 2000 21:56:22 +0100 Organization: Customer of Planet Online Lines: 43 Message-ID: <39776776.53A0F8EB@phekda.freeserve.co.uk> References: <8l7agq$t7f$1 AT riker DOT addcom DOT de> NNTP-Posting-Host: modem-7.doxycycline.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news8.svr.pol.co.uk 964128949 9936 62.136.91.7 (20 Jul 2000 21:35:49 GMT) NNTP-Posting-Date: 20 Jul 2000 21:35:49 GMT X-Complaints-To: abuse AT theplanet DOT net X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586) X-Accept-Language: de,fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello. Thorsten Erdmann wrote: > I have some problems hooking an own filesystem driver to DJGPPs > filesystem extension. All works fine except the close function. [snip] > /**********************************************************************/ > /* lfn_fclose : close file */ > /**------------------------------------------------------------------**/ > /* input : fd - file descriptor */ > /* output: zero if ok, else feof */ > /**********************************************************************/ > int lfn_close(int fd) > { > _MYFILE *f; > if (!(f=__FSEXT_get_data(fd))) return -2; > free(f->sector); > free(f); > _dos_close(fd); > > return 0; > } I think you should also put the following calls in, just before _dos_close(): free(f); /* New code */ __FSEXT_set_data(fd, NULL); __FSEXT_set_function(fd, NULL); /* End new code */ _dos_close(fd); If you do not do this, many of the I/O functions will think that the fd is valid, because they will find an entry in the FSEXT table for the (now invalid) file descriptor. The extra code above will stop 'fd' being used like that. I don't know if this will fix your problem, however. Hope this helps, bye, -- Richard Dawe [ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]