Commit Diff


commit - d82de447b42ca88a01181f9cd6a1f45cfde478a3
commit + 56bef47ace1a7a76503a86a73aa58d022e7f9006
blob - 2238e3a287aad6db2ee4725210be30d96274f92e
blob + 3cb0ac26f390059d1c584ba1c6b0b86e5bfb1af6
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -301,6 +301,10 @@ receive_packidx(struct got_packidx **packidx, struct i
 	p->len = ipackidx.len;
 	p->fd = dup(imsg.fd);
 	if (p->fd == -1) {
+		err = got_error_from_errno();
+		goto done;
+	}
+	if (lseek(p->fd, 0, SEEK_SET) == -1) {
 		err = got_error_from_errno();
 		goto done;
 	}
@@ -366,6 +370,10 @@ receive_pack(struct got_pack **packp, struct imsgbuf *
 		err = got_error_from_errno();
 		goto done;
 	}
+	if (lseek(pack->fd, 0, SEEK_SET) == -1) {
+		err = got_error_from_errno();
+		goto done;
+	}
 	pack->path_packfile = strdup(ipack.path_packfile);
 	if (pack->path_packfile == NULL) {
 		err = got_error_from_errno();