Commit Diff


commit - 6ae16afd7eb87b9d1ae10d16f29e1a66649decc7
commit + 15f404b1ceddb96797adc6a015786806435fc153
blob - 57a92c08b9d52ddc94273eb0e356af566991e9ea
blob + 0e18f194406f1c8fe2f30bab9b5c8a3a3c0a6e5f
--- libexec/got-send-pack/got-send-pack.c
+++ libexec/got-send-pack/got-send-pack.c
@@ -52,6 +52,7 @@
 #include "got_lib_pkt.h"
 #include "got_lib_gitproto.h"
 #include "got_lib_ratelimit.h"
+#include "got_lib_poll.h"
 
 #ifndef nitems
 #define nitems(_a)	(sizeof((_a)) / sizeof((_a)[0]))
@@ -146,7 +147,7 @@ send_pack_file(int sendfd, int packfd, struct imsgbuf 
 {
 	const struct got_error *err;
 	unsigned char buf[8192];
-	ssize_t r, w;
+	ssize_t r;
 	off_t wtotal = 0;
 	struct got_ratelimit rl;
 
@@ -161,12 +162,10 @@ send_pack_file(int sendfd, int packfd, struct imsgbuf 
 			return got_error_from_errno("read");
 		if (r == 0)
 			break;
-		w = write(sendfd, buf, r);
-		if (w == -1)
-			return got_error_from_errno("write");
-		if (w != r)
-			return got_error(GOT_ERR_IO);
-		wtotal += w;
+		err = got_poll_write_full(sendfd, buf, r);
+		if (err)
+			return NULL;
+		wtotal += r;
 		err = send_upload_progress(ibuf, wtotal, &rl);
 		if (err)
 			return err;