transport-helper: drop read/write errno checks
Since we use xread() and xwrite() here, EINTR, EAGAIN, and EWOULDBLOCK retries are already handled for us, and we will never see these errno values ourselves. We can drop these conditions entirely, making the code easier to follow. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jan 11, 2018 at 01:31 UTC
d4c813689b2b320f8907a615fcf1f1d27ae44f37
1 file changed
+2
-3
transport-helper.c
+2
-3
@@ -1226,8 +1226,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
1226
1227
transfer_debug("%s is readable", t->src_name);
1228
bytes = xread(t->src, t->buf + t->bufuse, BUFFERSIZE - t->bufuse);
1229
- if (bytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN &&
1230
- errno != EINTR) {
1229
+ if (bytes < 0) {
1230
error_errno(_("read(%s) failed"), t->src_name);
1231
return -1;
1232
} else if (bytes == 0) {
@@ -1254,7 +1253,7 @@ static int udt_do_write(struct unidirectional_transfer *t)
1253
1254
transfer_debug("%s is writable", t->dest_name);
1255
bytes = xwrite(t->dest, t->buf, t->bufuse);
1257
- if (bytes < 0 && errno != EWOULDBLOCK) {
1256
+ if (bytes < 0) {
1257
error_errno(_("write(%s) failed"), t->dest_name);
1258
return -1;
1259
} else if (bytes > 0) {