commit - 4174659e52427b7735c85d6561739b4e4323ad3c5594f45d131e6399d9194c3a
commit + 8b548f3204aa9834989a33553110d2ec2a67191856812c836b5e0380f84839e8
blob - d412683b9daab3a372fb45922d7782bd5dfc329576a82deaff0b10b5c3313a91
blob + 79daa2630a7c0f6536b8634bc9fe1bee9954d8d7c4de34c2c5bb95f8013814f4
--- lib/got_lib_privsep.h
+++ lib/got_lib_privsep.h
const struct got_error *got_privsep_send_object_idlist(struct imsgbuf *,
struct got_object_id **, size_t);
const struct got_error *got_privsep_send_object_idlist_done(struct imsgbuf *);
-const struct got_error *got_privsep_recv_object_idlist(int *,
- struct got_object_id **, size_t *, struct imsgbuf *);
+const struct got_error *got_privsep_recv_object_idlist(struct got_object_id **,
+ size_t *, struct imsgbuf *);
const struct got_error *got_privsep_send_object_id_queue(struct imsgbuf *ibuf,
struct got_object_id_queue *, size_t);
blob - 54f207b5181f199711cd3a0bb28a51fd5178d7c3ce1e1332623ed705378ec155
blob + 86fc260e730ccaa0f68118329659b7e9e850be2cad638765c51de3f3f57bce26
--- lib/privsep.c
+++ lib/privsep.c
}
const struct got_error *
-got_privsep_recv_object_idlist(int *done, struct got_object_id **ids,
+got_privsep_recv_object_idlist(struct got_object_id **ids,
size_t *nids, struct imsgbuf *ibuf)
{
const struct got_error *err = NULL;
+ int done = 0;
*ids = NULL;
- *done = 0;
*nids = 0;
- while (err == NULL && *done == 0)
- err = recv_object_idlist_chunk(done, ids, nids, ibuf);
+ while (err == NULL && !done)
+ err = recv_object_idlist_chunk(&done, ids, nids, ibuf);
return err;
}
blob - 6feb8535ed41cb3b56d0d4d40499de7110259aef287f266d6a343ae96e46b136
blob + 5939c96523bcb2fe537afdb18dcb5a949ae2d32f9353ea1e7e1d5bac6dc364e2
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
recv_object_ids(struct got_object_idset *idset, struct imsgbuf *ibuf)
{
const struct got_error *err = NULL;
- int done = 0;
struct got_object_id *ids;
size_t nids, i;
- while (!done) {
- err = got_privsep_recv_object_idlist(&done, &ids, &nids, ibuf);
- if (err || done)
+ err = got_privsep_recv_object_idlist(&ids, &nids, ibuf);
+ if (err)
+ return err;
+
+ for (i = 0; i < nids; i++) {
+ err = got_object_idset_add(idset, &ids[i], NULL);
+ if (err)
break;
- for (i = 0; i < nids; i++) {
- err = got_object_idset_add(idset, &ids[i], NULL);
- if (err) {
- free(ids);
- return err;
- }
- }
- free(ids);
}
+ free(ids);
return err;
}
static const struct got_error *
-recv_object_id_queue(size_t *nids_total, struct got_object_id_queue *queue,
+recv_object_id_queue(size_t *nids, struct got_object_id_queue *queue,
void *data, struct got_object_idset *queued_ids, struct imsgbuf *ibuf)
{
const struct got_error *err = NULL;
- int done = 0;
struct got_object_qid *qid;
struct got_object_id *ids;
- size_t nids, i;
+ size_t i;
- *nids_total = 0;
- while (!done) {
- err = got_privsep_recv_object_idlist(&done, &ids, &nids, ibuf);
+ err = got_privsep_recv_object_idlist(&ids, nids, ibuf);
+ if (err)
+ return err;
+
+ for (i = 0; i < *nids; i++) {
+ err = got_object_qid_alloc_partial(&qid);
if (err)
break;
- *nids_total += nids;
- for (i = 0; i < nids; i++) {
- err = got_object_qid_alloc_partial(&qid);
+ memcpy(&qid->id, &ids[i], sizeof(qid->id));
+ if (data)
+ qid->data = data;
+ STAILQ_INSERT_TAIL(queue, qid, entry);
+ if (queued_ids) {
+ err = got_object_idset_add(queued_ids,
+ &qid->id, NULL);
if (err)
- goto done;
- memcpy(&qid->id, &ids[i], sizeof(qid->id));
- if (data)
- qid->data = data;
- STAILQ_INSERT_TAIL(queue, qid, entry);
- if (queued_ids) {
- err = got_object_idset_add(queued_ids,
- &qid->id, NULL);
- if (err)
- goto done;
- }
+ break;
}
- free(ids);
- ids = NULL;
}
-done:
+
free(ids);
return err;
}