Commit Diff


commit - 04b841e4697edff06c9f91aacea329b970b76f59
commit + 2b02ed351e68831d6bd5bc93f18d563679084a51
blob - 25d0ffb75d7e8448d934b6c293c32e6502583ca6
blob + 287ba8003842bf4e78f4beda762dda10d88e453b
--- lib/repository.c
+++ lib/repository.c
@@ -395,6 +395,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);