Hi, The 12th patch tests for availability of sigaction, and uses signal instead if not available. Without sigaction, signals have to be re-activated once triggered, because signal does an implicit SA_RESETHAND on SYSV platforms. Regards, Alain diff -X ../exclude.txt -urN dash-0.5.12+11-simplify-wait-loop/configure.ac dash-0.5.12+12-sigaction/configure.ac --- dash-0.5.12+11-simplify-wait-loop/configure.ac 2024-11-10 17:06:50.301341251 +0000 +++ dash-0.5.12+12-sigaction/configure.ac 2024-11-10 17:08:01.155025888 +0000 @@ -73,6 +73,17 @@ AC_TYPE_SSIZE_T AC_TYPE_UINT32_T +AC_CHECK_TYPE([sig_atomic_t],,AC_DEFINE_UNQUOTED([sig_atomic_t],int,[Define atomic signal type]),[ +AC_INCLUDES_DEFAULT +#include <signal.h> +]) + +AC_CHECK_TYPE([sigset_t],,AC_DEFINE_UNQUOTED([sigset_t],int,[Define type for signal mask, may be int where signal blocking is not supported at all]),[ +AC_INCLUDES_DEFAULT +#include <signal.h> +]) + + AC_CHECK_TYPE([intmax_t],,AC_DEFINE_UNQUOTED([intmax_t],long,[Define intmax_t type, must also be supported by printf])) AC_CHECK_TYPE([uintmax_t],,AC_DEFINE_UNQUOTED([uintmax_t],unsigned long,[Define uintmax_t type, must also be supported by printf])) @@ -106,7 +117,7 @@ mempcpy memmove \ sigsetmask stpcpy strchrnul strsignal strtod strtoimax \ strtoumax sysconf \ - vfork lstat dup2 getgroups \ + vfork sigaction sigprocmask lstat dup2 getgroups \ strstr stpncpy strcasecmp strerror strdup strtoul vsnprintf \ readdir) diff -X ../exclude.txt -urN dash-0.5.12+11-simplify-wait-loop/src/system.h dash-0.5.12+12-sigaction/src/system.h --- dash-0.5.12+11-simplify-wait-loop/src/system.h 2024-11-10 16:26:48.720196946 +0000 +++ dash-0.5.12+12-sigaction/src/system.h 2024-11-10 16:26:47.464166999 +0000 @@ -48,9 +48,11 @@ #pragma GCC diagnostic pop #endif #else +# ifdef HAVE_SIGPROCMASK sigset_t set; sigemptyset(&set); sigprocmask(SIG_SETMASK, &set, 0); +# endif #endif } diff -X ../exclude.txt -urN dash-0.5.12+11-simplify-wait-loop/src/trap.c dash-0.5.12+12-sigaction/src/trap.c --- dash-0.5.12+11-simplify-wait-loop/src/trap.c 2024-11-10 14:59:12.583223512 +0000 +++ dash-0.5.12+12-sigaction/src/trap.c 2024-11-10 20:26:44.222071158 +0000 @@ -181,7 +181,16 @@ int action; int lvforked; char *t, tsig; +#ifdef HAVE_SIGACTION struct sigaction act; +#define SIGNAL(signo) sigaction(signo, &act,0) +#define HDLR act.sa_handler +#else + typedef void (*sighandler_t)(int); + sighandler_t hdlr; +#define SIGNAL(signo) signal(signo, hdlr) +#define HDLR hdlr +#endif lvforked = vforked; @@ -222,6 +231,7 @@ t = &sigmode[signo - 1]; tsig = *t; +#ifdef HAVE_SIGACTION if (tsig == 0) { /* * current setting unknown @@ -244,23 +254,28 @@ tsig = S_RESET; /* force to be set */ } } - if (tsig == S_HARD_IGN || tsig == action) + if (tsig == action) + return; +#endif + if (tsig == S_HARD_IGN) return; switch (action) { case S_CATCH: - act.sa_handler = onsig; + HDLR = onsig; break; case S_IGN: - act.sa_handler = SIG_IGN; + HDLR = SIG_IGN; break; default: - act.sa_handler = SIG_DFL; + HDLR = SIG_DFL; } if (!lvforked) *t = action; +#ifdef HAVE_SIGACTION act.sa_flags = 0; sigfillset(&act.sa_mask); - sigaction(signo, &act, 0); +#endif + SIGNAL(signo); } /* @@ -286,6 +301,9 @@ void onsig(int signo) { +#ifndef HAVE_SIGACTION + signal(signo, onsig); +#endif if (vforked) return; @@ -441,8 +459,13 @@ void sigblockall(sigset_t *oldmask) { +#ifdef HAVE_SIGPROCMASK sigset_t mask; sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, oldmask); +#else + if(oldmask) + *oldmask = 0; +#endif }