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 | |
parent | b797b92237276b87bb758648d61ef71579befc5b (diff) |
- (stevesk) add mysignal() wrapper and use it for the protocol 2
SIGCHLD handler.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | misc.c | 23 | ||||
-rw-r--r-- | misc.h | 4 | ||||
-rw-r--r-- | serverloop.c | 4 |
4 files changed, 31 insertions, 2 deletions
@@ -29,6 +29,8 @@ | |||
29 | - (djm) Update several bits for new optional reverse lookup stuff. I | 29 | - (djm) Update several bits for new optional reverse lookup stuff. I |
30 | think I got them all. | 30 | think I got them all. |
31 | - (djm) Makefile.in fixes | 31 | - (djm) Makefile.in fixes |
32 | - (stevesk) add mysignal() wrapper and use it for the protocol 2 | ||
33 | SIGCHLD handler. | ||
32 | 34 | ||
33 | 20010103 | 35 | 20010103 |
34 | - (bal) Cygwin clean up by Corinna Vinschen <vinschen@redhat.com> | 36 | - (bal) Cygwin clean up by Corinna Vinschen <vinschen@redhat.com> |
@@ -27,6 +27,7 @@ | |||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: util.c,v 1.6 2000/10/27 07:32:19 markus Exp $"); | 28 | RCSID("$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 | |||
100 | mysig_t | ||
101 | mysignal(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 | } | ||
@@ -19,3 +19,7 @@ char *strdelim(char **s); | |||
19 | 19 | ||
20 | /* set filedescriptor to non-blocking */ | 20 | /* set filedescriptor to non-blocking */ |
21 | void set_nonblock(int fd); | 21 | void set_nonblock(int fd); |
22 | |||
23 | /* wrapper for signal interface */ | ||
24 | typedef void (*mysig_t)(int); | ||
25 | mysig_t mysignal(int sig, mysig_t act); | ||
diff --git a/serverloop.c b/serverloop.c index bdac6a0d2..353733d31 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -110,7 +110,7 @@ sigchld_handler2(int sig) | |||
110 | int save_errno = errno; | 110 | int save_errno = errno; |
111 | debug("Received SIGCHLD."); | 111 | debug("Received SIGCHLD."); |
112 | child_terminated = 1; | 112 | child_terminated = 1; |
113 | signal(SIGCHLD, sigchld_handler2); | 113 | mysignal(SIGCHLD, sigchld_handler2); |
114 | errno = save_errno; | 114 | errno = save_errno; |
115 | } | 115 | } |
116 | 116 | ||
@@ -639,7 +639,7 @@ server_loop2(void) | |||
639 | 639 | ||
640 | debug("Entering interactive session for SSH2."); | 640 | debug("Entering interactive session for SSH2."); |
641 | 641 | ||
642 | signal(SIGCHLD, sigchld_handler2); | 642 | mysignal(SIGCHLD, sigchld_handler2); |
643 | signal(SIGPIPE, SIG_IGN); | 643 | signal(SIGPIPE, SIG_IGN); |
644 | child_terminated = 0; | 644 | child_terminated = 0; |
645 | connection_in = packet_get_connection_in(); | 645 | connection_in = packet_get_connection_in(); |