diff options
Diffstat (limited to 'debian/patches/ssh-sigchld.patch')
-rw-r--r-- | debian/patches/ssh-sigchld.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/patches/ssh-sigchld.patch b/debian/patches/ssh-sigchld.patch new file mode 100644 index 000000000..21d286b21 --- /dev/null +++ b/debian/patches/ssh-sigchld.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | Description: Install a SIGCHLD handler to reap expired child processes | ||
2 | Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/openssh/main/revision/6166 | ||
3 | Bug-Debian: http://bugs.debian.org/594687 | ||
4 | Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1812 | ||
5 | Forwarded: not-needed | ||
6 | Last-Update: 2010-10-26 | ||
7 | |||
8 | Index: b/ssh.c | ||
9 | =================================================================== | ||
10 | --- a/ssh.c | ||
11 | +++ b/ssh.c | ||
12 | @@ -50,6 +50,7 @@ | ||
13 | #include <sys/ioctl.h> | ||
14 | #include <sys/param.h> | ||
15 | #include <sys/socket.h> | ||
16 | +#include <sys/wait.h> | ||
17 | |||
18 | #include <ctype.h> | ||
19 | #include <errno.h> | ||
20 | @@ -210,6 +211,7 @@ | ||
21 | static int ssh_session(void); | ||
22 | static int ssh_session2(void); | ||
23 | static void load_public_identity_files(void); | ||
24 | +static void main_sigchld_handler(int); | ||
25 | |||
26 | /* from muxclient.c */ | ||
27 | void muxclient(const char *); | ||
28 | @@ -849,6 +851,7 @@ | ||
29 | tilde_expand_filename(options.user_hostfile2, original_real_uid); | ||
30 | |||
31 | signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */ | ||
32 | + signal(SIGCHLD, main_sigchld_handler); | ||
33 | |||
34 | /* Log into the remote system. Never returns if the login fails. */ | ||
35 | ssh_login(&sensitive_data, host, (struct sockaddr *)&hostaddr, | ||
36 | @@ -1532,3 +1535,19 @@ | ||
37 | bzero(pwdir, strlen(pwdir)); | ||
38 | xfree(pwdir); | ||
39 | } | ||
40 | + | ||
41 | +static void | ||
42 | +main_sigchld_handler(int sig) | ||
43 | +{ | ||
44 | + int save_errno = errno; | ||
45 | + pid_t pid; | ||
46 | + int status; | ||
47 | + | ||
48 | + while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || | ||
49 | + (pid < 0 && errno == EINTR)) | ||
50 | + ; | ||
51 | + | ||
52 | + signal(sig, main_sigchld_handler); | ||
53 | + errno = save_errno; | ||
54 | +} | ||
55 | + | ||