Commit Diff


commit - 3fa67434f818eb74503c8b812c0a506ae1c650fa
commit + fc842fc8042ddce403d11cfeca3d40c6e80cc2f3
blob - 8e8fa8cd52baa65aa76c0a56a4df206a5c0906b5
blob + 9848199ea0f505dd27688d8bbcb0d9825a1f3ed9
--- lib/got_lib_privsep.h
+++ lib/got_lib_privsep.h
@@ -220,7 +220,7 @@ struct got_imsg_error {
  * Structure for GOT_IMSG_TREE_REQUEST and GOT_IMSG_OBJECT data.
  */
 struct got_imsg_object {
-	uint8_t id[SHA1_DIGEST_LENGTH];
+	struct got_object_id id;
 
 	/* These fields are the same as in struct got_object. */
 	int type;
blob - 5490b22f536975ef6009f10e8c9939072b0580f3
blob + 9a07b1a40063226ca288a0a32e223888e7d00065
--- lib/privsep.c
+++ lib/privsep.c
@@ -398,7 +398,7 @@ got_privsep_send_tree_req(struct imsgbuf *ibuf, int fd
 	if (wbuf == NULL)
 		return got_error_from_errno("imsg_create TREE_REQUEST");
 
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+	if (imsg_add(wbuf, id, sizeof(*id)) == -1)
 		return got_error_from_errno("imsg_add TREE_REQUEST");
 
 	if (pack_idx != -1) { /* tree is packed */
@@ -510,7 +510,7 @@ got_privsep_send_obj(struct imsgbuf *ibuf, struct got_
 
 	memset(&iobj, 0, sizeof(iobj));
 
-	memcpy(iobj.id, obj->id.sha1, sizeof(iobj.id));
+	memcpy(&iobj.id, &obj->id, sizeof(iobj.id));
 	iobj.type = obj->type;
 	iobj.flags = obj->flags;
 	iobj.hdrlen = obj->hdrlen;
@@ -1118,7 +1118,7 @@ got_privsep_get_imsg_obj(struct got_object **obj, stru
 	if (*obj == NULL)
 		return got_error_from_errno("calloc");
 
-	memcpy((*obj)->id.sha1, iobj->id, SHA1_DIGEST_LENGTH);
+	memcpy(&(*obj)->id, &iobj->id, sizeof(iobj->id));
 	(*obj)->type = iobj->type;
 	(*obj)->flags = iobj->flags;
 	(*obj)->hdrlen = iobj->hdrlen;