commit 4b4da3bbc7a791ba0d7d9d369dfe1e7b65f7eed4 from: Omar Polo date: Wed Feb 01 13:46:07 2023 UTC got_imsg_fetch_have_ref: use struct instead of buffer for id ok stsp@ commit - 839bbaae43d84a7eb75ef0b327239fd36c360ada commit + 4b4da3bbc7a791ba0d7d9d369dfe1e7b65f7eed4 blob - cce4cea87c0a4dcf12328d3491728a50bcce8f84 blob + 5cd84b1d07b71a363119a7b5be1358853e0bbae4 --- lib/got_lib_privsep.h +++ lib/got_lib_privsep.h @@ -384,7 +384,7 @@ struct got_imsg_tag_object { /* Structure for GOT_IMSG_FETCH_HAVE_REF data. */ struct got_imsg_fetch_have_ref { - uint8_t id[SHA1_DIGEST_LENGTH]; + struct got_object_id id; size_t name_len; /* Followed by name_len data bytes. */ } __attribute__((__packed__)); blob - 48bdc5abc37116465cd5276b7720b4809ef3079c blob + 8d1d159abb0e90556d55e25ea4c8cd028a9deed9 --- lib/privsep.c +++ lib/privsep.c @@ -578,7 +578,7 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int f return got_error_from_errno("imsg_create FETCH_HAVE_REF"); /* Keep in sync with struct got_imsg_fetch_have_ref! */ - if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -1) + if (imsg_add(wbuf, id, sizeof(*id)) == -1) return got_error_from_errno("imsg_add FETCH_HAVE_REF"); if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) return got_error_from_errno("imsg_add FETCH_HAVE_REF"); blob - 6e1ae2146ae101481c8223adead2d0fbc046ed00 blob + c50d0f24ed274911250dfe62449bff9b131f93d3 --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -866,7 +866,7 @@ main(int argc, char **argv) err = got_error_from_errno("malloc"); goto done; } - memcpy(id->sha1, href.id, SHA1_DIGEST_LENGTH); + memcpy(id, &href.id, sizeof(*id)); err = got_pathlist_append(&have_refs, refname, id); if (err) { free(refname);