1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:05:07 +00:00

Fix sys$sigaction() to return the old action metadata if requested.

This commit is contained in:
Andreas Kling 2018-11-07 10:48:44 +01:00
parent 0b3e927597
commit e088121b3a
2 changed files with 7 additions and 1 deletions

View file

@ -1564,6 +1564,12 @@ int Process::sys$sigaction(int signum, const Unix::sigaction* act, Unix::sigacti
VALIDATE_USER_READ(act, sizeof(Unix::sigaction));
InterruptDisabler disabler; // FIXME: This should use a narrower lock.
auto& action = m_signal_action_data[signum];
if (old_act) {
VALIDATE_USER_WRITE(old_act, sizeof(Unix::sigaction));
old_act->sa_flags = action.flags;
old_act->sa_restorer = (decltype(old_act->sa_restorer))action.restorer.get();
old_act->sa_sigaction = (decltype(old_act->sa_sigaction))action.handler_or_sigaction.get();
}
action.restorer = LinearAddress((dword)act->sa_restorer);
action.flags = act->sa_flags;
action.handler_or_sigaction = LinearAddress((dword)act->sa_sigaction);