=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/atomicio.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- src/usr.bin/ssh/atomicio.c 2019/01/23 08:01:46 1.29 +++ src/usr.bin/ssh/atomicio.c 2019/01/24 02:42:23 1.30 @@ -1,4 +1,4 @@ -/* $OpenBSD: atomicio.c,v 1.29 2019/01/23 08:01:46 dtucker Exp $ */ +/* $OpenBSD: atomicio.c,v 1.30 2019/01/24 02:42:23 dtucker Exp $ */ /* * Copyright (c) 2006 Damien Miller. All rights reserved. * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved. @@ -54,15 +54,14 @@ res = (f) (fd, s + pos, n - pos); switch (res) { case -1: - switch(errno) { - case EINTR: + if (errno == EINTR) { /* possible SIGALARM, update callback */ if (cb != NULL && cb(cb_arg, 0) == -1) { errno = EINTR; return pos; } continue; - case EAGAIN: + } else if (errno == EAGAIN || errno == EWOULDBLOCK) { (void)poll(&pfd, 1, -1); continue; } @@ -113,15 +112,14 @@ res = (f) (fd, iov, iovcnt); switch (res) { case -1: - switch(errno) { - case EINTR: + if (errno == EINTR) { /* possible SIGALARM, update callback */ if (cb != NULL && cb(cb_arg, 0) == -1) { errno = EINTR; return pos; } continue; - case EAGAIN: + } else if (errno == EAGAIN || errno == EWOULDBLOCK) { (void)poll(&pfd, 1, -1); continue; }