Patch to fix exit()'s atexit loop

Richard Sandiford rsandifo@redhat.com
Thu Oct 23 07:59:00 GMT 2003


Approved by Jeff & installed.

Richard


	* libc/stdlib/exit.c (exit): Handle null _GLOBAL_REENT->_atexits.

Index: libc/stdlib/exit.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/exit.c,v
retrieving revision 1.6
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.6 exit.c
--- libc/stdlib/exit.c	5 Sep 2003 18:22:00 -0000	1.6
+++ libc/stdlib/exit.c	22 Oct 2003 08:44:06 -0000
@@ -83,7 +83,7 @@ _DEFUN (exit, (code),
     }
 #else
   p = _GLOBAL_REENT->_atexit;
-  do
+  while (p)
     {
       args = & p->_on_exit_args;
   
@@ -95,7 +95,6 @@ _DEFUN (exit, (code),
 
       p = p->_next;
     }
-  while (p);
 #endif
 
   if (_GLOBAL_REENT->__cleanup)



More information about the Newlib mailing list