Commit Diff


commit - fe092c4f2a9d752a4c15ed2a4e4e2effea8bac141733e7974ace69519047e5c7
commit + d584927da52e61bdcaf302f4183ceb954d626c197b829854392e22a1ab01e07c
blob - d976c732f633f4c203cb62e79af2496a16976107ee72cf8e8bc009d996ad95df
blob + c61ebd2842a23a387576ff85d02408a7744667af65c2fbdd9b9058bd953f6320
--- gotd/session_write.c	
+++ gotd/session_write.c	
@@ -232,6 +232,8 @@ request_gotsys_conf(struct gotd_imsgev *iev)
 
 	if (ftruncate(gotd_session.content_fd, 0L) == -1)
 		return got_error_from_errno("ftruncate");
+	if (lseek(gotd_session.content_fd, 0L, SEEK_SET) == -1)
+		return got_error_from_errno("lseek");
 	
 	len = sizeof(content_req) + strlen(refname) + strlen(path);
 	wbuf = imsg_create(&iev->ibuf, GOTD_IMSG_PACKFILE_GET_CONTENT,
blob - c8a56db2e72bbf51f9c15192c5adbf43f0fb7d8df50fac41e624680e8eec967c
blob + 105cd1d1b85318e1f3ce0da69c36996d280dbfdaaa29cdfbe3c891de9dfd627e
--- gotsysd/libexec/gotsys-repo-create/gotsys-repo-create.c	
+++ gotsysd/libexec/gotsys-repo-create/gotsys-repo-create.c	
@@ -171,6 +171,10 @@ set_head_ref(int repos_dir_fd, const char *repo_name, 
 		err = got_error_from_errno2("ftruncate", relpath);
 		goto done;
 	}
+	if (lseek(fd, 0L, SEEK_SET) == -1) {
+		err = got_error_from_errno2("lseek", relpath);
+		goto done;
+	}
 
 	w = write(fd, content, content_len);
 	if (w == -1)
blob - f9d3e7f971501023a6ef5483a4af62f6db4bef59b2db8e67c7e44e90dbb67880
blob + b0044e1519e28ef0e9c047bde6dad79c0e057436ec11579c0eda65c9ffd379bb
--- gotsysd/libexec/gotsys-write-conf/gotsys-write-conf.c	
+++ gotsysd/libexec/gotsys-write-conf/gotsys-write-conf.c	
@@ -333,6 +333,8 @@ write_gotd_conf(void)
 
 	if (ftruncate(gotd_conf_tmpfd, 0) == -1)
 		return got_error_from_errno("ftruncate");
+	if (lseek(gotd_conf_tmpfd, 0L, SEEK_SET) == -1)
+		return got_error_from_errno("lseek");
 
 	if (clock_gettime(CLOCK_MONOTONIC, &now) == -1)
 		return got_error_from_errno("clock_gettime");
blob - 26fd5d50fee8d727d253f429e1d0db431a1b7422c6a5f2f0c8cbd9068d3cfe72
blob + d626a865602cb9c483e913c2691c67a353784e6b8bb0291ccaf1744a08d56fbc
--- lib/repository.c	
+++ lib/repository.c	
@@ -1606,8 +1606,12 @@ got_repo_cache_pack(struct got_pack **packp, struct go
 			return err;
 		if (ftruncate(repo->packs[i].basefd, 0L) == -1)
 			return got_error_from_errno("ftruncate");
+		if (lseek(repo->packs[i].basefd, 0L, SEEK_SET) == -1)
+			return got_error_from_errno("lseek");
 		if (ftruncate(repo->packs[i].accumfd, 0L) == -1)
 			return got_error_from_errno("ftruncate");
+		if (lseek(repo->packs[i].accumfd, 0L, SEEK_SET) == -1)
+			return got_error_from_errno("lseek");
 	}
 
 	if (i != 0) {