about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-05 22:34:59 +0000
committerRoland McGrath <roland@gnu.org>2002-12-05 22:34:59 +0000
commitca4961c0956bb3a6ed4fee5181717afbe4978058 (patch)
treeffd13550cab2abc6c7fdcee245b247c6c4260e86
parent11767d4767d1f8c688f31f05f52f2edc83a1cdaf (diff)
downloadglibc-ca4961c0956bb3a6ed4fee5181717afbe4978058.tar.gz
glibc-ca4961c0956bb3a6ed4fee5181717afbe4978058.tar.xz
glibc-ca4961c0956bb3a6ed4fee5181717afbe4978058.zip
* stdlib/cxa_finalize.c (__cxa_finalize): When given a null argument,
	call all functions rather than none.
	Reported by Mark P. Mitchell <mark@codesourcery.com>.
-rw-r--r--ChangeLog6
-rw-r--r--stdlib/cxa_finalize.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index edb051c37d..aabb59a0bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-12-05  Roland McGrath  <roland@redhat.com>
+
+	* stdlib/cxa_finalize.c (__cxa_finalize): When given a null argument,
+	call all functions rather than none.
+	Reported by Mark P. Mitchell <mark@codesourcery.com>.
+
 2002-12-04  Roland McGrath  <roland@redhat.com>
 
 	* locale/localeinfo.h [NL_CURRENT_INDIRECT]: Use attribute_tls_model_ie
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index e42f6bd71c..16f50286e1 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -29,15 +29,12 @@ __cxa_finalize (void *d)
 {
   struct exit_function_list *funcs;
 
-  if (!d)
-    return;
-
   for (funcs = __exit_funcs; funcs; funcs = funcs->next)
     {
       struct exit_function *f;
 
       for (f = &funcs->fns[funcs->idx - 1]; f >= &funcs->fns[0]; --f)
-	if (d == f->func.cxa.dso_handle
+	if ((d == NULL || d == f->func.cxa.dso_handle)
 	    /* We don't want to run this cleanup more than once.  */
 	    && compare_and_swap (&f->flavor, ef_cxa, ef_free))
 	  (*f->func.cxa.fn) (f->func.cxa.arg, 0);