diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2016-02-05 13:28:20 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2016-02-05 13:28:20 +0000 |
commit | b0988d72c14fe4eac98367913db3008fc6d180ba (patch) | |
tree | c74429ec0bdcb1ce18b24236fc5fbe81f8249a33 | |
parent | ebcf87d4eeced0ef5a3434aa7c2fe34626942a13 (diff) |
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@
-rw-r--r-- | usr.bin/ssh/channels.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index 4c5b8904a49..06689b4a8af 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.348 2015/10/15 23:51:40 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.349 2016/02/05 13:28:19 naddy Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1869,13 +1869,13 @@ read_mux(Channel *c, u_int need) if (buffer_len(&c->input) < need) { rlen = need - buffer_len(&c->input); len = read(c->rfd, buf, MIN(rlen, CHAN_RBUF)); + if (len < 0 && (errno == EINTR || errno == EAGAIN)) + return buffer_len(&c->input); if (len <= 0) { - if (errno != EINTR && errno != EAGAIN) { - debug2("channel %d: ctl read<=0 rfd %d len %d", - c->self, c->rfd, len); - chan_read_failed(c); - return 0; - } + debug2("channel %d: ctl read<=0 rfd %d len %d", + c->self, c->rfd, len); + chan_read_failed(c); + return 0; } else buffer_append(&c->input, buf, len); } |