mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 03:45:24 +00:00
libc: avoid nesting of atexit handler calls
In some situations, atexit handlers perform I/O (e.g., closing a file), which entails the handling of signals. Should SIGTERM be pending, the handling of this signal will in turn trigger the execution of atexit handlers. To break this cycle, this patch removes atexit handlers from the list before executing them. So no atexit handler is entered more than once. Fixes #5444
This commit is contained in:
parent
9795f264aa
commit
d2adfa150b
@ -111,8 +111,8 @@ struct Libc::Atexit : Noncopyable
|
||||
if (!handler_ptr)
|
||||
return false;
|
||||
|
||||
handler_ptr->execute();
|
||||
_handlers.remove(handler_ptr);
|
||||
handler_ptr->execute();
|
||||
destroy(_alloc, handler_ptr);
|
||||
return true;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user