From: Todd C. Miller Subject: Re: readpassphrase(3): avoid spin on ignored signals To: Damien Miller Cc: Philip Guenther , tech@openbsd.org Date: Tue, 15 Sep 2026 10:44:17 -0600 On Tue, 15 Sep 2026 17:20:22 +1000, Damien Miller wrote: > Something like the below? That looks reasonable, though the special case for "old == NULL" makes me a little uncomfortable. Another alternative would be: /* Like sigaction(2) but preserves SIG_IGN */ static void sigaction_except_ign(int signum, struct sigaction *act, struct sigaction *old) { struct sigaction sabuf; if (old == NULL) old = &sabuf; (void)sigaction(signum, act, old); /* Reinstate SIG_IGN; we don't want to override this */ if (old->sa_handler == SIG_IGN && act->sa_handler != SIG_IGN) (void)sigaction(signum, old, NULL); }