зеркало из https://github.com/Azure/sonic-openssh.git
- (stevesk) add mysignal() wrapper and use it for the protocol 2
SIGCHLD handler.
This commit is contained in:
Родитель
b797b92237
Коммит
b6e773acc9
|
@ -29,6 +29,8 @@
|
||||||
- (djm) Update several bits for new optional reverse lookup stuff. I
|
- (djm) Update several bits for new optional reverse lookup stuff. I
|
||||||
think I got them all.
|
think I got them all.
|
||||||
- (djm) Makefile.in fixes
|
- (djm) Makefile.in fixes
|
||||||
|
- (stevesk) add mysignal() wrapper and use it for the protocol 2
|
||||||
|
SIGCHLD handler.
|
||||||
|
|
||||||
20010103
|
20010103
|
||||||
- (bal) Cygwin clean up by Corinna Vinschen <vinschen@redhat.com>
|
- (bal) Cygwin clean up by Corinna Vinschen <vinschen@redhat.com>
|
||||||
|
|
23
misc.c
23
misc.c
|
@ -27,6 +27,7 @@
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: util.c,v 1.6 2000/10/27 07:32:19 markus Exp $");
|
RCSID("$OpenBSD: util.c,v 1.6 2000/10/27 07:32:19 markus Exp $");
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
@ -95,3 +96,25 @@ strdelim(char **s)
|
||||||
|
|
||||||
return (old);
|
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 */
|
/* set filedescriptor to non-blocking */
|
||||||
void set_nonblock(int fd);
|
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;
|
int save_errno = errno;
|
||||||
debug("Received SIGCHLD.");
|
debug("Received SIGCHLD.");
|
||||||
child_terminated = 1;
|
child_terminated = 1;
|
||||||
signal(SIGCHLD, sigchld_handler2);
|
mysignal(SIGCHLD, sigchld_handler2);
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ server_loop2(void)
|
||||||
|
|
||||||
debug("Entering interactive session for SSH2.");
|
debug("Entering interactive session for SSH2.");
|
||||||
|
|
||||||
signal(SIGCHLD, sigchld_handler2);
|
mysignal(SIGCHLD, sigchld_handler2);
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
child_terminated = 0;
|
child_terminated = 0;
|
||||||
connection_in = packet_get_connection_in();
|
connection_in = packet_get_connection_in();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче