about summary refs log tree commit diff
path: root/stdlib/cxa_finalize.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-19 18:26:10 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-19 18:26:10 +0000
commit4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061 (patch)
tree5d2a3274fca36375eb460f483d802db22c0fea5e /stdlib/cxa_finalize.c
parent2c008571c3ad156479307b7e23185ae566b5776a (diff)
downloadglibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.tar.gz
glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.tar.xz
glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.zip
Update.
	* stdlib/cxa_finalize.c (__cxa_finalize): Don't call
	UNREGISTER_ATFORK if d == NULL.
Diffstat (limited to 'stdlib/cxa_finalize.c')
-rw-r--r--stdlib/cxa_finalize.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index 792aeeb3b5..2339c7b5bd 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -23,7 +23,8 @@
 #include <fork.h>
 
 /* If D is non-NULL, call all functions registered with `__cxa_atexit'
-   with the same dso handle.  Otherwise, if D is NULL, do nothing.  */
+   with the same dso handle.  Otherwise, if D is NULL, call all of the
+   registered handlers.  */
 void
 __cxa_finalize (void *d)
 {
@@ -41,8 +42,10 @@ __cxa_finalize (void *d)
 	  (*f->func.cxa.fn) (f->func.cxa.arg, 0);
     }
 
-  /* Remove the registered fork handlers.  */
+  /* Remove the registered fork handlers.  We do not have to
+     unregister anything if the program is going to terminate anyway.  */
 #ifdef UNREGISTER_ATFORK
-  UNREGISTER_ATFORK (d);
+  if (d != NULL)
+    UNREGISTER_ATFORK (d);
 #endif
 }