Commit Diff


commit - c33c3763d3c9e005bb51d9d3a6aab3bedc50bf2e
commit + e294dc4e38dcf1364451a3a7a3724a07a9e42048
blob - 06a5bdff23de1154538510232e0cf2998523a312
blob + b425ba49c41d4c20c076b2c6c6a77b84366abf0d
--- 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;
 		}