summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authornaddy@openbsd.org <naddy@openbsd.org>2016-02-05 13:28:19 +0000
committerDamien Miller <djm@mindrot.org>2016-02-08 21:58:31 +1100
commit603ba41179e4b53951c7b90ee95b6ef3faa3f15d (patch)
tree0930d731703295df9cdea1b30c5e1ff75473aa2f /channels.c
parent56d7dac790693ce420d225119283bc355cff9185 (diff)
upstream commit
Only check errno if read() has returned an error. EOF is not an error. This fixes a problem where the mux master would sporadically fail to notice that the client had exited. ok mikeb@ djm@ Upstream-ID: 3c2dadc21fac6ef64665688aac8a75fffd57ae53
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/channels.c b/channels.c
index fdd89a5a0..c9d2015ee 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.348 2015/10/15 23:51:40 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.349 2016/02/05 13:28:19 naddy 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
@@ -1896,13 +1896,13 @@ read_mux(Channel *c, u_int need)
1896 if (buffer_len(&c->input) < need) { 1896 if (buffer_len(&c->input) < need) {
1897 rlen = need - buffer_len(&c->input); 1897 rlen = need - buffer_len(&c->input);
1898 len = read(c->rfd, buf, MIN(rlen, CHAN_RBUF)); 1898 len = read(c->rfd, buf, MIN(rlen, CHAN_RBUF));
1899 if (len < 0 && (errno == EINTR || errno == EAGAIN))
1900 return buffer_len(&c->input);
1899 if (len <= 0) { 1901 if (len <= 0) {
1900 if (errno != EINTR && errno != EAGAIN) { 1902 debug2("channel %d: ctl read<=0 rfd %d len %d",
1901 debug2("channel %d: ctl read<=0 rfd %d len %d", 1903 c->self, c->rfd, len);
1902 c->self, c->rfd, len); 1904 chan_read_failed(c);
1903 chan_read_failed(c); 1905 return 0;
1904 return 0;
1905 }
1906 } else 1906 } else
1907 buffer_append(&c->input, buf, len); 1907 buffer_append(&c->input, buf, len);
1908 } 1908 }