pass an object_id * to got_privsep_send_index_pack_req()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
diff --git a/lib/fetch.c b/lib/fetch.c
index 7c5ea03..5c25534 100644
--- a/lib/fetch.c
+++ b/lib/fetch.c
@@ -339,7 +339,7 @@ got_clone(char *uri, char *branch_filter, char *destdir)
return got_error_from_errno("close");
imsg_init(&ibuf, imsg_idxfds[0]);
- err = got_privsep_send_index_pack_req(&ibuf, npackfd, packhash);
+ err = got_privsep_send_index_pack_req(&ibuf, npackfd, &packhash);
if (err != NULL)
return err;
err = got_privsep_send_tmpfd(&ibuf, nidxfd);
diff --git a/lib/got_lib_privsep.h b/lib/got_lib_privsep.h
index 12c2aa8..59fe6e9 100644
--- a/lib/got_lib_privsep.h
+++ b/lib/got_lib_privsep.h
@@ -311,7 +311,7 @@ const struct got_error *got_privsep_send_tmpfd(struct imsgbuf *, int);
const struct got_error *got_privsep_send_obj(struct imsgbuf *,
struct got_object *);
const struct got_error *got_privsep_send_index_pack_req(struct imsgbuf *, int,
- struct got_object_id);
+ struct got_object_id *);
const struct got_error *got_privsep_send_index_pack_done(struct imsgbuf *);
const struct got_error *got_privsep_wait_index_pack_done(struct imsgbuf *);
const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int);
diff --git a/lib/privsep.c b/lib/privsep.c
index 90f056a..b60af9d 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -446,12 +446,12 @@ got_privsep_wait_fetch_done(struct imsgbuf *ibuf, struct got_object_id *hash)
const struct got_error *
-got_privsep_send_index_pack_req(struct imsgbuf *ibuf, int fd, struct got_object_id hash)
+got_privsep_send_index_pack_req(struct imsgbuf *ibuf, int fd, struct got_object_id *hash)
{
const struct got_error *err = NULL;
if (imsg_compose(ibuf, GOT_IMSG_IDXPACK_REQUEST, 0, 0, fd,
- hash.sha1, SHA1_DIGEST_LENGTH) == -1) {
+ hash->sha1, SHA1_DIGEST_LENGTH) == -1) {
err = got_error_from_errno("imsg_compose INDEX_REQUEST");
close(fd);
return err;
diff --git a/libexec/got-index-pack/got-index-pack.c b/libexec/got-index-pack/got-index-pack.c
index cd6e4f4..752b92d 100644
--- a/libexec/got-index-pack/got-index-pack.c
+++ b/libexec/got-index-pack/got-index-pack.c
@@ -1085,7 +1085,7 @@ objectcrc(FILE *f, Object *o)
}
int
-indexpack(int packfd, int idxfd, struct got_object_id packhash)
+indexpack(int packfd, int idxfd, struct got_object_id *packhash)
{
char hdr[4*3], buf[8];
int nobj, nvalid, nbig, n, i, step;
@@ -1192,7 +1192,7 @@ indexpack(int packfd, int idxfd, struct got_object_id packhash)
hwrite(f, buf, 8, &ctx);
}
}
- hwrite(f, packhash.sha1, sizeof(packhash.sha1), &ctx);
+ hwrite(f, packhash->sha1, sizeof(packhash->sha1), &ctx);
SHA1Final(h.sha1, &ctx);
fwrite(h.sha1, 1, sizeof(h.sha1), f);
@@ -1254,7 +1254,7 @@ main(int argc, char **argv)
}
idxfd = imsg.fd;
- indexpack(packfd, idxfd, packhash);
+ indexpack(packfd, idxfd, &packhash);
done:
if(err != NULL)
got_privsep_send_error(&ibuf, err);