mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibC: Mark atexit() entries as 'called' before calling them
This guards as from recursing into an atexit callback if exit() is called from within it.
This commit is contained in:
parent
deda7c8995
commit
9eaa6527f7
Notes:
sideshowbarker
2024-07-18 20:58:22 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/9eaa6527f73 Pull-request: https://github.com/SerenityOS/serenity/pull/6006
@ -101,10 +101,10 @@ void __cxa_finalize(void* dso_handle)
|
||||
bool needs_calling = !exit_entry.has_been_called && (!dso_handle || dso_handle == exit_entry.dso_handle);
|
||||
if (needs_calling) {
|
||||
dbgln_if(GLOBAL_DTORS_DEBUG, "__cxa_finalize: calling entry[{}] {:p}({:p}) dso: {:p}", entry_index, exit_entry.method, exit_entry.parameter, exit_entry.dso_handle);
|
||||
exit_entry.method(exit_entry.parameter);
|
||||
unlock_atexit_handlers();
|
||||
exit_entry.has_been_called = true;
|
||||
lock_atexit_handlers();
|
||||
exit_entry.method(exit_entry.parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user