diff --git a/src/lib/libc/stdlib/atexit.c b/src/lib/libc/stdlib/atexit.c index a44de37c..83cc1282 100644 --- a/src/lib/libc/stdlib/atexit.c +++ b/src/lib/libc/stdlib/atexit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atexit.c,v 1.23 2015/10/25 18:03:17 guenther Exp $ */ +/* $OpenBSD: atexit.c,v 1.24 2015/11/10 04:14:03 guenther Exp $ */ /* * Copyright (c) 2002 Daniel Hartmeier * All rights reserved. @@ -109,6 +109,18 @@ unlock: } DEF_STRONG(__cxa_atexit); +/* + * Copy of atexit() used by libc and anything staticly linked into the + * executable. This passes NULL for the dso, so the callbacks are only + * invoked by exit() and not dlclose() + */ +int +atexit(void (*fn)(void)) +{ + return (__cxa_atexit((void (*)(void *))fn, NULL, NULL)); +} +DEF_STRONG(atexit); + /* * Call all handlers registered with __cxa_atexit() for the shared * object owning 'dso'.