commit 85e62fc9f57c4a31877fcf257477a7dc5075903f from: Omar Polo date: Thu Jul 11 08:07:42 2024 UTC use proper type for got_imsg_enumerated_commit ok stsp@ commit - 0f9ed2af036df203ad7b7e5b7e54756bf36a7c4c commit + 85e62fc9f57c4a31877fcf257477a7dc5075903f blob - 86c780f1b39bd6593b1deb94215ecf9405b05740 blob + 7511786325d8e67359b25d6e5a6983eaf0f84457 --- lib/got_lib_privsep.h +++ lib/got_lib_privsep.h @@ -592,7 +592,7 @@ struct got_imsg_traversed_commits { /* Structure for GOT_IMSG_ENUMERATED_COMMIT */ struct got_imsg_enumerated_commit { - uint8_t id[SHA1_DIGEST_LENGTH]; + struct got_object_id id; time_t mtime; } __attribute__((__packed__)); blob - 337a7e73209bcce74e47b6f588ebc9eef0119ae9 blob + e51908c9bc07441fc896089ee1c96ad436e9c94a --- lib/privsep.c +++ lib/privsep.c @@ -2824,12 +2824,12 @@ got_privsep_send_enumerated_commit(struct imsgbuf *ibu struct ibuf *wbuf; wbuf = imsg_create(ibuf, GOT_IMSG_ENUMERATED_COMMIT, 0, 0, - sizeof(struct got_imsg_enumerated_commit) + SHA1_DIGEST_LENGTH); + sizeof(struct got_imsg_enumerated_commit)); if (wbuf == NULL) return got_error_from_errno("imsg_create ENUMERATED_COMMIT"); /* Keep in sync with struct got_imsg_enumerated_commit! */ - if (imsg_add(wbuf, id, SHA1_DIGEST_LENGTH) == -1) + if (imsg_add(wbuf, id, sizeof(*id)) == -1) return got_error_from_errno("imsg_add ENUMERATED_COMMIT"); if (imsg_add(wbuf, &mtime, sizeof(mtime)) == -1) return got_error_from_errno("imsg_add ENUMERATED_COMMIT"); @@ -2880,7 +2880,7 @@ got_privsep_recv_enumerated_objects(int *found_all_obj break; } icommit = (struct got_imsg_enumerated_commit *)imsg.data; - memcpy(commit_id.sha1, icommit->id, SHA1_DIGEST_LENGTH); + memcpy(&commit_id, &icommit->id, sizeof(commit_id)); mtime = icommit->mtime; have_commit = 1; break;