$NetBSD: patch-ad,v 1.4 2025/04/29 09:10:51 tnn Exp $ --- lib/sighandle.c.orig 2003-10-05 03:49:29.000000000 +0000 +++ lib/sighandle.c @@ -56,7 +56,7 @@ char *malloc(); /* Define linked list of signal handlers structure */ struct SIG_hlist { - RETSIGTYPE (*handler)(); + RETSIGTYPE (*handler)(int); struct SIG_hlist *next; }; @@ -204,8 +204,10 @@ static RETSIGTYPE SIG_handle (int sig) this = SIG_handlers[sig]; while (this != (struct SIG_hlist *) NULL) { - (*this->handler)(sig); + /* handler may free this (and thus clobber this->next) */ + struct SIG_hlist *current = this; this = this->next; + (*current->handler)(sig); } SIG_endCrSect(); @@ -220,7 +222,7 @@ static RETSIGTYPE SIG_handle (int sig) * restoration later. */ -int SIG_register(int sig, RETSIGTYPE (*fn)()) +int SIG_register(int sig, RETSIGTYPE (*fn)(int)) { int val; struct SIG_hlist *this;