Commit Diff


commit - 74737945d01fa40a64535be8018c8dc44859b524
commit + 1c9d898d6c7c6c8681e8e191ebe2c01b8d066f6e
blob - 4f35feba02a39ad0317cd252dc1020e7194747e1
blob + 0b79ca86d66d8554b1da1a6a03a6ea7e0d1a3541
--- lib/serve.c
+++ lib/serve.c
@@ -971,7 +971,7 @@ serve_read(int infd, int outfd, int gotd_sock, const c
 		pack_chunksize = sizeof(buf);
 
 	for (;;) {
-		ssize_t r, w;
+		ssize_t r;
 
 		r = read(packfd, use_sidebands ? &buf[1] : buf,
 		    pack_chunksize);
@@ -989,12 +989,10 @@ serve_read(int infd, int outfd, int gotd_sock, const c
 			if (err)
 				break;
 		} else {
-			w = write(outfd, buf, r);
-			if (w == -1) {
-				err = got_error_from_errno("write");
-				break;
-			} else if (w != r) {
-				err = got_error(GOT_ERR_IO);
+			err = got_poll_write_full(outfd, buf, r);
+			if (err) {
+				if (err->code == GOT_ERR_EOF)
+					err = NULL;
 				break;
 			}
 		}