Commit Diff


commit - a66a4a5063151449b830f5510f00717296fa3c3d
commit + da2c57e47ed0bc5cab959b65eab66a3c6e7b1a61
blob - c09b746529fffca03c46c600740baf5e048a63ce
blob + 9a74186f5e65b0a0e6893e93a18e84b6d18c611b
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -938,15 +938,17 @@ recv_packfile(int *have_packfile, struct imsg *imsg)
 	}
 
 	for (i = 0; i < nitems(tempfiles); i++) {
-		int fd = dup(repo_tempfiles[i].fd);
+		int fd;
 		FILE *f;
+
+		fd = dup(repo_tempfiles[i].fd);
 		if (fd == -1) {
 			err = got_error_from_errno("dup");
 			goto done;
 		}
 		f = fdopen(fd, "w+");
 		if (f == NULL) {
-			err = got_error_from_errno("dup");
+			err = got_error_from_errno("fdopen");
 			close(fd);
 			goto done;
 		}