diff options
author | Kevin Steves <stevesk@pobox.com> | 2001-02-04 13:20:36 +0000 |
---|---|---|
committer | Kevin Steves <stevesk@pobox.com> | 2001-02-04 13:20:36 +0000 |
commit | b6e773acc9f27118b215a892ba704123a6df7b72 (patch) | |
tree | 083542bf79b817ac9790232c14d7a508f0d6ecc0 /misc.c | |
parent | b797b92237276b87bb758648d61ef71579befc5b (diff) |
- (stevesk) add mysignal() wrapper and use it for the protocol 2
SIGCHLD handler.
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -27,6 +27,7 @@ #include "includes.h" RCSID("$OpenBSD: util.c,v 1.6 2000/10/27 07:32:19 markus Exp $"); +#include "misc.h" #include "ssh.h" #include "log.h" @@ -95,3 +96,25 @@ strdelim(char **s) return (old); } + +mysig_t +mysignal(int sig, mysig_t act) +{ +#ifdef HAVE_SIGACTION + struct sigaction sa, osa; + + if (sigaction(sig, 0, &osa) == -1) + return (mysig_t) -1; + if (osa.sa_handler != act) { + memset(&sa, 0, sizeof sa); + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = act; + if (sigaction(sig, &sa, 0) == -1) + return (mysig_t) -1; + } + return (osa.sa_handler); +#else + return (signal(sig, act)); +#endif +} |