- (stevesk) add mysignal() wrapper and use it for the protocol 2
SIGCHLD handler.
This commit is contained in:
parent
b797b92237
commit
b6e773acc9
|
@ -29,6 +29,8 @@
|
|||
- (djm) Update several bits for new optional reverse lookup stuff. I
|
||||
think I got them all.
|
||||
- (djm) Makefile.in fixes
|
||||
- (stevesk) add mysignal() wrapper and use it for the protocol 2
|
||||
SIGCHLD handler.
|
||||
|
||||
20010103
|
||||
- (bal) Cygwin clean up by Corinna Vinschen <vinschen@redhat.com>
|
||||
|
|
23
misc.c
23
misc.c
|
@ -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
|
||||
}
|
||||
|
|
4
misc.h
4
misc.h
|
@ -19,3 +19,7 @@ char *strdelim(char **s);
|
|||
|
||||
/* set filedescriptor to non-blocking */
|
||||
void set_nonblock(int fd);
|
||||
|
||||
/* wrapper for signal interface */
|
||||
typedef void (*mysig_t)(int);
|
||||
mysig_t mysignal(int sig, mysig_t act);
|
||||
|
|
|
@ -110,7 +110,7 @@ sigchld_handler2(int sig)
|
|||
int save_errno = errno;
|
||||
debug("Received SIGCHLD.");
|
||||
child_terminated = 1;
|
||||
signal(SIGCHLD, sigchld_handler2);
|
||||
mysignal(SIGCHLD, sigchld_handler2);
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
|
@ -639,7 +639,7 @@ server_loop2(void)
|
|||
|
||||
debug("Entering interactive session for SSH2.");
|
||||
|
||||
signal(SIGCHLD, sigchld_handler2);
|
||||
mysignal(SIGCHLD, sigchld_handler2);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
child_terminated = 0;
|
||||
connection_in = packet_get_connection_in();
|
||||
|
|
Loading…
Reference in New Issue