From 3afaaa1e4a76d38dc90d9860b42e132342568d6e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 28 Aug 2017 07:03:41 +0000 Subject: Catch signals with SA_RESTART unless iopause is select() --- package/deps.mak | 2 +- src/libstddjb/skasigaction.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package/deps.mak b/package/deps.mak index 3bf37f1..7f839c8 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -482,7 +482,7 @@ src/libstddjb/skagetln_nofill.o src/libstddjb/skagetln_nofill.lo: src/libstddjb/ src/libstddjb/skagetlnsep.o src/libstddjb/skagetlnsep.lo: src/libstddjb/skagetlnsep.c src/include/skalibs/buffer.h src/include/skalibs/siovec.h src/include/skalibs/skamisc.h src/include/skalibs/stralloc.h src/libstddjb/skalibs_tzisright.o src/libstddjb/skalibs_tzisright.lo: src/libstddjb/skalibs_tzisright.c src/libstddjb/djbtime-internal.h src/libstddjb/skasig_dfl.o src/libstddjb/skasig_dfl.lo: src/libstddjb/skasig_dfl.c src/include/skalibs/sig.h -src/libstddjb/skasigaction.o src/libstddjb/skasigaction.lo: src/libstddjb/skasigaction.c src/include/skalibs/sig.h +src/libstddjb/skasigaction.o src/libstddjb/skasigaction.lo: src/libstddjb/skasigaction.c src/include/skalibs/config.h src/include/skalibs/sig.h src/libstddjb/slurp.o src/libstddjb/slurp.lo: src/libstddjb/slurp.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/stralloc.h src/libstddjb/socket_accept4.o src/libstddjb/socket_accept4.lo: src/libstddjb/socket_accept4.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/sysdeps.h src/include/skalibs/uint16.h src/libstddjb/socket_accept4_u32.o src/libstddjb/socket_accept4_u32.lo: src/libstddjb/socket_accept4_u32.c src/include/skalibs/socket.h src/include/skalibs/uint32.h diff --git a/src/libstddjb/skasigaction.c b/src/libstddjb/skasigaction.c index 4b1ea8b..e86cc0c 100644 --- a/src/libstddjb/skasigaction.c +++ b/src/libstddjb/skasigaction.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include #include #include @@ -9,6 +10,9 @@ int skasigaction (int sig, struct skasigaction const *new, struct skasigaction * if (((new->flags & SKASA_MASKALL) ? sigfillset(&sanew.sa_mask) : sigemptyset(&sanew.sa_mask)) == -1) return -1 ; sanew.sa_handler = new->handler ; sanew.sa_flags = (new->flags & SKASA_NOCLDSTOP) ? SA_NOCLDSTOP : 0 ; +#ifndef SKALIBS_FLAG_PREFERSELECT + sanew.sa_flags |= SA_RESTART ; +#endif if (sigaction(sig, &sanew, &saold) < 0) return -1 ; if (old) { -- cgit v1.2.3