commit f9f544689c6f4d8dd6dfb97da00ffbaf987ddab4 from: Omar Polo via: Thomas Adam date: Fri Feb 03 15:22:14 2023 UTC got_imsg_fetch_have_ref: use struct instead of buffer for id ok stsp@ commit - 851a5b487c47bf2fb5deec019a049ee0aa7389ca commit + f9f544689c6f4d8dd6dfb97da00ffbaf987ddab4 blob - d79b113af28100c54b6f82d0f6eaecd37cb038e2 blob + 6a2f4e7414235ad63b95198e47dd00e878cce04c --- 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 - fa06692e098df51709ea8fb02f1886572c45fd5a blob + e78d9db9fa71b3ce3cd587e874c6e2255d7972fa --- 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 - dbfaae68ac376c1a772e9b1e6360ddf9decc1f3e blob + bc787d9884c4a2f26911098698dd62a16e7d308f --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -878,7 +878,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);