Commit Diff


commit - 529f16d393fbab504621b40449967a0a33f4041c
commit + 590e3746314124e5c82cdda11846c8678e53e27c
blob - 8d2c4a28815971860618446c5701073d301b1ee6
blob + 175996e19e6d5ed9c58c09fb0722aef4dab5cd75
--- lib/repository.c
+++ lib/repository.c
@@ -399,6 +399,8 @@ got_repo_temp_fds_get(int *fd, int *idx, struct got_re
 		if (repo->tempfiles[i] != -1) {
 			if (ftruncate(repo->tempfiles[i], 0L) == -1)
 				return got_error_from_errno("ftruncate");
+			if (lseek(repo->tempfiles[i], 0L, SEEK_SET) == -1)
+				return got_error_from_errno("lseek");
 			*fd = repo->tempfiles[i];
 			*idx = i;
 			repo->tempfile_use_mask |= (1 << i);