diff options
author | jdp <jdp@FreeBSD.org> | 1999-10-09 00:25:29 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 1999-10-09 00:25:29 +0000 |
commit | 96c8cdf38c4d3671274821d98bee7542fde5275d (patch) | |
tree | f8ee0b0eeb4891a94f341d7c32c5aab5f314063f /lib/libc/compat-43/sigcompat.c | |
parent | 9cb1556e4ffc5fb183a8fb3004a867bb824cbd3b (diff) | |
download | FreeBSD-src-96c8cdf38c4d3671274821d98bee7542fde5275d.zip FreeBSD-src-96c8cdf38c4d3671274821d98bee7542fde5275d.tar.gz |
Fix sigvec(). When the sigset_t changes came in, it was altered
to call osigaction(). But that's wrong because it causes the
handler to receive a struct osigcontext instead of the expected
struct sigcontext. Use sigaction() instead, copying the compatible
portion of the signal mask.
Reviewed by: marcel
Diffstat (limited to 'lib/libc/compat-43/sigcompat.c')
-rw-r--r-- | lib/libc/compat-43/sigcompat.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c index 46431ef..0a870a7 100644 --- a/lib/libc/compat-43/sigcompat.c +++ b/lib/libc/compat-43/sigcompat.c @@ -47,14 +47,25 @@ sigvec(signo, sv, osv) int signo; struct sigvec *sv, *osv; { + struct sigaction sa, osa; + struct sigaction *sap, *osap; int ret; - if (sv) - sv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ - ret = osigaction(signo, (struct osigaction *)sv, - (struct osigaction *)osv); - if (ret == 0 && osv) - osv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ + if (sv != NULL) { + sa.sa_handler = sv->sv_handler; + sa.sa_flags = sv->sv_flags ^ SV_INTERRUPT; + sigemptyset(&sa.sa_mask); + sa.sa_mask.__bits[0] = sv->sv_mask; + sap = &sa; + } else + sap = NULL; + osap = osv != NULL ? &osa : NULL; + ret = sigaction(signo, sap, osap); + if (ret == 0 && osv != NULL) { + osv->sv_handler = osa.sa_handler; + osv->sv_flags = osa.sa_flags ^ SV_INTERRUPT; + osv->sv_mask = osa.sa_mask.__bits[0]; + } return (ret); } |