From 4d3dc4a77f23a6de5f65c072bb8890143165f996 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Wed, 9 Mar 2005 16:56:05 +0000 Subject: [PATCH] - The stdio destructor no longer resets the __iob pointer to NULL. This avoids trouble with destructor functions which use stdio code. Unsolved problem: the order in which destructors and constructors are called. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14870 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/GNUmakefile.os4 | 4 ++-- library/stdio_init_exit.c | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index b302378..4862ffe 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.37 2005-03-09 10:48:58 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.38 2005-03-09 16:56:04 obarthel Exp $ # # :ts=8 # @@ -113,7 +113,7 @@ WARNINGS = \ INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE) OPTIONS = -D__THREAD_SAFE -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames OPTIMIZE = -O -fomit-frame-pointer -funroll-loops -#DEBUG = -g +DEBUG = -g2 CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDES) diff --git a/library/stdio_init_exit.c b/library/stdio_init_exit.c index 71ee2de..f7aa56f 100644 --- a/library/stdio_init_exit.c +++ b/library/stdio_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: stdio_init_exit.c,v 1.24 2005-03-07 11:16:43 obarthel Exp $ + * $Id: stdio_init_exit.c,v 1.25 2005-03-09 16:56:05 obarthel Exp $ * * :ts=4 * @@ -58,7 +58,7 @@ __close_all_files(void) __stdio_lock(); - if(__iob != NULL && __num_iob > 0) + if(__num_iob > 0) { for(i = 0 ; i < __num_iob ; i++) { @@ -66,11 +66,10 @@ __close_all_files(void) fclose((FILE *)__iob[i]); } - __num_iob = 0; - __iob = NULL; + __num_iob = 0; } - if(__fd != NULL && __num_fd > 0) + if(__num_fd > 0) { for(i = 0 ; i < __num_fd ; i++) { @@ -78,8 +77,7 @@ __close_all_files(void) close(i); } - __num_fd = 0; - __fd = NULL; + __num_fd = 0; } __stdio_unlock();