From: "Tim Van Holder" To: Subject: Re: Our unlink() isn't POSIX Date: Mon, 18 Jun 2001 18:51:15 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > > It keeps a table of files it has opened; this table has an associated > > cleanup function that unlinks those that need to be removed. But it > > never seems to close those files (or not all of them anyway), resulting > > in an error in unlink() (on LoseME anyway). > > I've now simply added a call to the stdio_cleanup_proc in those places > > where an _fcloseall() was added on Lose32. > > Isn't it cleaner to close each file just before it is unlinked? > Yes - but the file table keeps only names, not FILE*s/fds. In order to do the clean thing, I'd have to introduce a new field in that table, and I'm loath to do this (for example, if I keep a FILE* there, what happens if it is fclose()'d later? The cleanup function would try to fclose() an already closed/deallocated FILE*. I agree it's not the cleanest fix, but it's the best I could without making major modifications to the source.