Contents of /trunk/openssh/patches/openssh-4.6p1-chan-read-failed-error.patch
Parent Directory | Revision Log
Revision 153 -
(show annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 3328 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 3328 byte(s)
-import
1 | Index: channels.c |
2 | =================================================================== |
3 | RCS file: /usr/local/src/security/openssh/cvs/openssh/channels.c,v |
4 | retrieving revision 1.251 |
5 | diff -u -p -r1.251 channels.c |
6 | --- channels.c 28 Jan 2007 23:16:28 -0000 1.251 |
7 | +++ channels.c 10 Apr 2007 02:35:06 -0000 |
8 | @@ -932,7 +932,7 @@ channel_pre_x11_open(Channel *c, fd_set |
9 | } else if (ret == -1) { |
10 | logit("X11 connection rejected because of wrong authentication."); |
11 | debug2("X11 rejected %d i%d/o%d", c->self, c->istate, c->ostate); |
12 | - chan_read_failed(c); |
13 | + chan_read_failed(c, 0); |
14 | buffer_clear(&c->input); |
15 | chan_ibuf_empty(c); |
16 | buffer_clear(&c->output); |
17 | @@ -1446,12 +1446,13 @@ static int |
18 | channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset) |
19 | { |
20 | char buf[CHAN_RBUF]; |
21 | - int len; |
22 | + int len, save_errno; |
23 | |
24 | if (c->rfd != -1 && |
25 | (c->detach_close || FD_ISSET(c->rfd, readset))) { |
26 | errno = 0; |
27 | len = read(c->rfd, buf, sizeof(buf)); |
28 | + save_errno = errno; |
29 | if (len < 0 && (errno == EINTR || |
30 | (errno == EAGAIN && !(c->isatty && c->detach_close)))) |
31 | return 1; |
32 | @@ -1472,14 +1473,14 @@ channel_handle_rfd(Channel *c, fd_set *r |
33 | c->type = SSH_CHANNEL_INPUT_DRAINING; |
34 | debug2("channel %d: input draining.", c->self); |
35 | } else { |
36 | - chan_read_failed(c); |
37 | + chan_read_failed(c, save_errno); |
38 | } |
39 | return -1; |
40 | } |
41 | if (c->input_filter != NULL) { |
42 | if (c->input_filter(c, buf, len) == -1) { |
43 | debug2("channel %d: filter stops", c->self); |
44 | - chan_read_failed(c); |
45 | + chan_read_failed(c, 0); |
46 | } |
47 | } else if (c->datagram) { |
48 | buffer_put_string(&c->input, buf, len); |
49 | @@ -1643,7 +1644,7 @@ channel_handle_ctl(Channel *c, fd_set *r |
50 | chan_mark_dead(c); |
51 | return -1; |
52 | } else { |
53 | - chan_read_failed(c); |
54 | + chan_read_failed(c, 0); |
55 | chan_write_failed(c); |
56 | } |
57 | return -1; |
58 | Index: channels.h |
59 | =================================================================== |
60 | RCS file: /usr/local/src/security/openssh/cvs/openssh/channels.h,v |
61 | retrieving revision 1.81 |
62 | diff -u -p -r1.81 channels.h |
63 | --- channels.h 5 Aug 2006 02:39:39 -0000 1.81 |
64 | +++ channels.h 10 Apr 2007 02:01:21 -0000 |
65 | @@ -240,7 +240,7 @@ void chan_mark_dead(Channel *); |
66 | /* channel events */ |
67 | |
68 | void chan_rcvd_oclose(Channel *); |
69 | -void chan_read_failed(Channel *); |
70 | +void chan_read_failed(Channel *, int); |
71 | void chan_ibuf_empty(Channel *); |
72 | |
73 | void chan_rcvd_ieof(Channel *); |
74 | Index: nchan.c |
75 | =================================================================== |
76 | RCS file: /usr/local/src/security/openssh/cvs/openssh/nchan.c,v |
77 | retrieving revision 1.56 |
78 | diff -u -p -r1.56 nchan.c |
79 | --- nchan.c 5 Aug 2006 02:39:40 -0000 1.56 |
80 | +++ nchan.c 10 Apr 2007 09:38:51 -0000 |
81 | @@ -133,17 +133,19 @@ chan_rcvd_oclose1(Channel *c) |
82 | } |
83 | } |
84 | void |
85 | -chan_read_failed(Channel *c) |
86 | +chan_read_failed(Channel *c, int err_no) |
87 | { |
88 | - debug2("channel %d: read failed", c->self); |
89 | + debug2("channel %d: read failed%s, istate %d", c->self, |
90 | + err_no ? "" : " (closed)", c->istate); |
91 | switch (c->istate) { |
92 | case CHAN_INPUT_OPEN: |
93 | chan_shutdown_read(c); |
94 | chan_set_istate(c, CHAN_INPUT_WAIT_DRAIN); |
95 | break; |
96 | default: |
97 | - error("channel %d: chan_read_failed for istate %d", |
98 | - c->self, c->istate); |
99 | + if (err_no != 0) |
100 | + error("channel %d: chan_read_failed for istate %d: %s", |
101 | + c->self, c->istate, strerror(err_no)); |
102 | break; |
103 | } |
104 | } |