summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 2d7b2fa60..a073c9052 100644
--- a/misc.c
+++ b/misc.c
@@ -27,6 +27,7 @@
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: util.c,v 1.6 2000/10/27 07:32:19 markus Exp $"); 28RCSID("$OpenBSD: util.c,v 1.6 2000/10/27 07:32:19 markus Exp $");
29 29
30#include "misc.h"
30#include "ssh.h" 31#include "ssh.h"
31#include "log.h" 32#include "log.h"
32 33
@@ -95,3 +96,25 @@ strdelim(char **s)
95 96
96 return (old); 97 return (old);
97} 98}
99
100mysig_t
101mysignal(int sig, mysig_t act)
102{
103#ifdef HAVE_SIGACTION
104 struct sigaction sa, osa;
105
106 if (sigaction(sig, 0, &osa) == -1)
107 return (mysig_t) -1;
108 if (osa.sa_handler != act) {
109 memset(&sa, 0, sizeof sa);
110 sigemptyset(&sa.sa_mask);
111 sa.sa_flags = 0;
112 sa.sa_handler = act;
113 if (sigaction(sig, &sa, 0) == -1)
114 return (mysig_t) -1;
115 }
116 return (osa.sa_handler);
117#else
118 return (signal(sig, act));
119#endif
120}