Register _cleanup function with atexit

* Register cleanup function with atexit
   instead of calling it explicitly on
   exit()
 * abort() no longer calls _cleanup:
   Flushing stdio buffers on abort is no
   longer required by POSIX.
 * dlmalloc no longer need to reset cleanup
   (see above)
 * Upstream findfp.c makebuf.c setvbuf.cexit.c
   to openbsd versions.

Bug: 14415367
Change-Id: I277058852485a9d3dbb13e5c232db5f9948d78ac
This commit is contained in:
Dmitriy Ivanov
2014-05-14 23:11:05 -07:00
parent 089c7c9217
commit 623b0d05bd
8 changed files with 73 additions and 100 deletions

View File

@@ -32,8 +32,6 @@
#include <unistd.h>
#include "atexit.h"
__LIBC_HIDDEN__ void (*__cleanup)();
#ifdef __arm__
extern "C" __LIBC_HIDDEN__ void __libc_android_abort()
#else
@@ -47,11 +45,6 @@ void abort()
sigdelset(&mask, SIGABRT);
sigprocmask(SIG_SETMASK, &mask, NULL);
// POSIX requires we flush stdio buffers on abort.
if (__cleanup) {
(*__cleanup)();
}
raise(SIGABRT);
// If SIGABRT ignored, or caught and the handler returns,