X-Git-Url: https://git.distorted.org.uk/~mdw/fwd/blobdiff_plain/9155ea97b695b6eb5fca1ee79f57b334f6c4ef53..e9940d072c811c67f2b3a13782fc40bf591491b7:/chan.c diff --git a/chan.c b/chan.c index e5b6d06..5fbecb1 100644 --- a/chan.c +++ b/chan.c @@ -80,9 +80,9 @@ static void writechan(int fd, unsigned mode, void *vp) if (w < 0) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) return; + c->err = errno; goto close; - } - else if (w == 0) + } else if (w == 0) goto close; else if (c->len == CHAN_BUFSZ && !(c->f & CHANF_CLOSE)) sel_addfile(&c->r); @@ -153,9 +153,9 @@ static void readchan(int fd, unsigned mode, void *vp) if (r < 0) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) return; + c->err = errno; goto close; - } - else if (r == 0) + } else if (r == 0) goto close; else if (c->len == 0 && (c->f & CHANF_READY)) { sel_addfile(&c->w);