quit: don't call signal() if we're using sigaction()
Some checks failed
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled

At best, this is a no-op.

At worst, it might:
 - Clobber a signal handler someone registered after us
 - Overwrite the signal mask or flags
 - Cause unregistration to fail (sigaction() isn't guaranteed to return the exact pointer passed to signal())

(cherry picked from commit 1d852d1c28)
This commit is contained in:
Cameron Gutman
2025-12-01 17:31:55 -06:00
parent 385e995790
commit c636332031

View File

@@ -49,8 +49,10 @@ static SDL_bool send_foregrounding_pending = SDL_FALSE;
static void SDL_HandleSIG(int sig)
{
/* Reset the signal handler */
#ifndef HAVE_SIGACTION
/* Reset the signal handler if it was installed with signal() */
(void)signal(sig, SDL_HandleSIG);
#endif
/* Send a quit event next time the event loop pumps. */
/* We can't send it in signal handler; SDL_malloc() might be interrupted! */