diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | ssh.c | 21 |
2 files changed, 23 insertions, 1 deletions
@@ -12,6 +12,9 @@ | |||
12 | - jmc@cvs.openbsd.org 2010/09/19 21:30:05 | 12 | - jmc@cvs.openbsd.org 2010/09/19 21:30:05 |
13 | [sftp.1] | 13 | [sftp.1] |
14 | more wacky macro fixing; | 14 | more wacky macro fixing; |
15 | - djm@cvs.openbsd.org 2010/09/20 04:41:47 | ||
16 | [ssh.c] | ||
17 | install a SIGCHLD handler to reap expiried child process; ok markus@ | ||
15 | 18 | ||
16 | 20100910 | 19 | 20100910 |
17 | - (dtucker) [openbsd-compat/port-linux.c] Check is_selinux_enabled for exact | 20 | - (dtucker) [openbsd-compat/port-linux.c] Check is_selinux_enabled for exact |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.351 2010/09/02 16:08:39 markus Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.352 2010/09/20 04:41:47 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -50,6 +50,7 @@ | |||
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/param.h> | 51 | #include <sys/param.h> |
52 | #include <sys/socket.h> | 52 | #include <sys/socket.h> |
53 | #include <sys/wait.h> | ||
53 | 54 | ||
54 | #include <ctype.h> | 55 | #include <ctype.h> |
55 | #include <errno.h> | 56 | #include <errno.h> |
@@ -210,6 +211,7 @@ usage(void) | |||
210 | static int ssh_session(void); | 211 | static int ssh_session(void); |
211 | static int ssh_session2(void); | 212 | static int ssh_session2(void); |
212 | static void load_public_identity_files(void); | 213 | static void load_public_identity_files(void); |
214 | static void main_sigchld_handler(int); | ||
213 | 215 | ||
214 | /* from muxclient.c */ | 216 | /* from muxclient.c */ |
215 | void muxclient(const char *); | 217 | void muxclient(const char *); |
@@ -877,6 +879,7 @@ main(int ac, char **av) | |||
877 | tilde_expand_filename(options.user_hostfile2, original_real_uid); | 879 | tilde_expand_filename(options.user_hostfile2, original_real_uid); |
878 | 880 | ||
879 | signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */ | 881 | signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */ |
882 | signal(SIGCHLD, main_sigchld_handler); | ||
880 | 883 | ||
881 | /* Log into the remote system. Never returns if the login fails. */ | 884 | /* Log into the remote system. Never returns if the login fails. */ |
882 | ssh_login(&sensitive_data, host, (struct sockaddr *)&hostaddr, | 885 | ssh_login(&sensitive_data, host, (struct sockaddr *)&hostaddr, |
@@ -1545,3 +1548,19 @@ load_public_identity_files(void) | |||
1545 | bzero(pwdir, strlen(pwdir)); | 1548 | bzero(pwdir, strlen(pwdir)); |
1546 | xfree(pwdir); | 1549 | xfree(pwdir); |
1547 | } | 1550 | } |
1551 | |||
1552 | static void | ||
1553 | main_sigchld_handler(int sig) | ||
1554 | { | ||
1555 | int save_errno = errno; | ||
1556 | pid_t pid; | ||
1557 | int status; | ||
1558 | |||
1559 | while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || | ||
1560 | (pid < 0 && errno == EINTR)) | ||
1561 | ; | ||
1562 | |||
1563 | signal(sig, main_sigchld_handler); | ||
1564 | errno = save_errno; | ||
1565 | } | ||
1566 | |||