delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/12/01/09:14:47

Message-Id: <3.0.1.32.19971201081749.007f8bb0@yacker.xiotech.com>
Date: Mon, 01 Dec 1997 08:17:49 -0600
To: djgpp-workers AT delorie DOT com
From: Randy Maas <randym AT acm DOT org>
Subject: Patch to exit.c
Mime-Version: 1.0

--=====================_881007469==_
Content-Type: text/plain; charset="us-ascii"

This is a patch to exit (relative to alpha 971114) that will close off any
still open fsexts.  It works by calling a hook last.  The hook is set to
point to the fsext routine only if fsext.c has initialized itself.  This
makes it so that exit.c does not require fsext, but uses it if is there.

Randy Maas
randym AT acm DOT org
--=====================_881007469==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="exit.dif"

*** src/libc/ansi/stdlib/exit.c~1	Fri Nov 14 19:58:08 1997
--- src/libc/ansi/stdlib/exit.c	Mon Dec  1 08:12:36 1997
***************
*** 13,16 ****
--- 13,20 ----
  void (*__stdio_cleanup_hook)(void);
  
+ /* A hook to close down the file system extensions if any where opened.
+    This does not force them to be linked in. */
+ void (*__FSEXT_exit_hook)(void) = NULL;
+ 
  typedef void (*FUNC)(void);
  extern FUNC djgpp_first_dtor[] __asm__("djgpp_first_dtor");
***************
*** 38,41 ****
--- 42,49 ----
    if (__stdio_cleanup_hook)
      __stdio_cleanup_hook();
+ 
+   /* Do this after the stdio cleanup to let it close off the fopen'd files */
+   if (__FSEXT_exit_hook)
+     __FSEXT_exit_hook();
  
    /* in case the program set it this way */

--=====================_881007469==_
Content-Type: text/plain; charset="us-ascii"



--=====================_881007469==_--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019