diff options
author | Darren Tucker <dtucker@dtucker.net> | 2019-10-11 14:12:16 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2019-10-11 14:12:16 +1100 |
commit | 9b9e3ca6945351eefb821ff783a4a8e6d9b98b9a (patch) | |
tree | f72fa93e6874ab4edfb2808ca4c78553ff8234dd | |
parent | 0bd312a362168c1eae3cd6b3889395a78e6fd0f8 (diff) |
Re-add SA_RESTART to mysignal.
This makes mysignal implement reliable BSD semantics according to
Stevens' APUE. This was first attempted in 2001 but was reverted
due to problems with HP-UX 10.20 and select() and possibly grantpt().
Modern systems should be fine with it, but if any current platforms have
a problem with it now we can disable it just for those. ok djm@
-rw-r--r-- | openbsd-compat/bsd-signal.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/openbsd-compat/bsd-signal.c b/openbsd-compat/bsd-signal.c index 0b816a3a6..104ab653f 100644 --- a/openbsd-compat/bsd-signal.c +++ b/openbsd-compat/bsd-signal.c | |||
@@ -37,10 +37,15 @@ mysignal(int sig, mysig_t act) | |||
37 | memset(&sa, 0, sizeof(sa)); | 37 | memset(&sa, 0, sizeof(sa)); |
38 | sigemptyset(&sa.sa_mask); | 38 | sigemptyset(&sa.sa_mask); |
39 | sa.sa_flags = 0; | 39 | sa.sa_flags = 0; |
40 | if (sig == SIGALRM) { | ||
40 | #ifdef SA_INTERRUPT | 41 | #ifdef SA_INTERRUPT |
41 | if (sig == SIGALRM) | ||
42 | sa.sa_flags |= SA_INTERRUPT; | 42 | sa.sa_flags |= SA_INTERRUPT; |
43 | #endif | 43 | #endif |
44 | } else { | ||
45 | #ifdef SA_RESTART | ||
46 | sa.sa_flags |= SA_RESTART; | ||
47 | #endif | ||
48 | } | ||
44 | sa.sa_handler = act; | 49 | sa.sa_handler = act; |
45 | if (sigaction(sig, &sa, NULL) == -1) | 50 | if (sigaction(sig, &sa, NULL) == -1) |
46 | return (mysig_t) -1; | 51 | return (mysig_t) -1; |