commit ac617115880dba63f046743d329f0498086950db from: Omar Polo via: Thomas Adam date: Fri Jul 12 06:00:18 2024 UTC use proper type for got_imsg_enumerated_commit ok stsp@ commit - eef1d245249331bf08381aadd8efc5cff7403c68 commit + ac617115880dba63f046743d329f0498086950db blob - 952f07df228ece0bf5959e243790cf8494534278 blob + adbbe1f6966f1814a34b228098272182fe1286aa --- 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 - 984cb86c8e9f5e14dd64a9d676235a77555bc510 blob + 9cbcb675b7312262df2e80015f56f28faf7afc4a --- 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;