commit - 06de99ad9dbe5d88d79f48101bd0b77c3eee9c5b
commit + e9f1a409ccc66a6fb79a3022695ca78ad26972ea
blob - 31c7ee88203604dd87e6e7fcd8fdde7035f5078e
blob + c0b028f2df10a4790b2d55637533cce65b42ab06
--- lib/privsep.c
+++ lib/privsep.c
return err;
}
- if (imsg_add(wbuf, &iobj, sizeof(iobj)) == -1) {
- err = got_error_from_errno("imsg_add RAW_OBJECT");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &iobj, sizeof(iobj)) == -1)
+ return got_error_from_errno("imsg_add RAW_OBJECT");
if (data && size + hdrlen <= GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX) {
- if (imsg_add(wbuf, data, size + hdrlen) == -1) {
- err = got_error_from_errno("imsg_add RAW_OBJECT");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, data, size + hdrlen) == -1)
+ return got_error_from_errno("imsg_add RAW_OBJECT");
}
wbuf->fd = -1;
got_privsep_send_tree_req(struct imsgbuf *ibuf, int fd,
struct got_object_id *id, int pack_idx)
{
- const struct got_error *err = NULL;
struct ibuf *wbuf;
size_t len;
if (wbuf == NULL)
return got_error_from_errno("imsg_create TREE_REQUEST");
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
- err = got_error_from_errno("imsg_add TREE_REQUEST");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+ return got_error_from_errno("imsg_add TREE_REQUEST");
if (pack_idx != -1) { /* tree is packed */
- if (imsg_add(wbuf, &pack_idx, sizeof(pack_idx)) == -1) {
- err = got_error_from_errno("imsg_add TREE_REQUEST");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &pack_idx, sizeof(pack_idx)) == -1)
+ return got_error_from_errno("imsg_add TREE_REQUEST");
}
wbuf->fd = fd;
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) {
- err = got_error_from_errno("imsg_add FETCH_HAVE_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
- err = got_error_from_errno("imsg_add FETCH_HAVE_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, name, name_len) == -1) {
- err = got_error_from_errno("imsg_add FETCH_HAVE_REF");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -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");
+ if (imsg_add(wbuf, name, name_len) == -1)
+ return got_error_from_errno("imsg_add FETCH_HAVE_REF");
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
"imsg_create FETCH_WANTED_BRANCH");
/* Keep in sync with struct got_imsg_fetch_wanted_branch! */
- if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
- err = got_error_from_errno(
+ if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+ return got_error_from_errno(
"imsg_add FETCH_WANTED_BRANCH");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, name, name_len) == -1) {
- err = got_error_from_errno(
+ if (imsg_add(wbuf, name, name_len) == -1)
+ return got_error_from_errno(
"imsg_add FETCH_WANTED_BRANCH");
- ibuf_free(wbuf);
- return err;
- }
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
"imsg_create FETCH_WANTED_REF");
/* Keep in sync with struct got_imsg_fetch_wanted_ref! */
- if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
- err = got_error_from_errno(
+ if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+ return got_error_from_errno(
"imsg_add FETCH_WANTED_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, name, name_len) == -1) {
- err = got_error_from_errno(
+ if (imsg_add(wbuf, name, name_len) == -1)
+ return got_error_from_errno(
"imsg_add FETCH_WANTED_REF");
- ibuf_free(wbuf);
- return err;
- }
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
send_send_ref(const char *name, size_t name_len, struct got_object_id *id,
int delete, struct imsgbuf *ibuf)
{
- const struct got_error *err = NULL;
size_t len;
struct ibuf *wbuf;
return got_error_from_errno("imsg_create SEND_REF");
/* Keep in sync with struct got_imsg_send_ref! */
- if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -1) {
- err = got_error_from_errno("imsg_add SEND_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &delete, sizeof(delete)) == -1) {
- err = got_error_from_errno("imsg_add SEND_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
- err = got_error_from_errno("imsg_add SEND_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, name, name_len) == -1) {
- err = got_error_from_errno("imsg_add SEND_REF");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, id->sha1, sizeof(id->sha1)) == -1)
+ return got_error_from_errno("imsg_add SEND_REF");
+ if (imsg_add(wbuf, &delete, sizeof(delete)) == -1)
+ return got_error_from_errno("imsg_add SEND_REF");
+ if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+ return got_error_from_errno("imsg_add SEND_REF");
+ if (imsg_add(wbuf, name, name_len) == -1)
+ return got_error_from_errno("imsg_add SEND_REF");
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
send_tree_entries(struct imsgbuf *ibuf, struct got_parsed_tree_entry *entries,
int idx0, int idxN, size_t len)
{
- static const struct got_error *err;
struct ibuf *wbuf;
struct got_imsg_tree_entries ientries;
int i;
return got_error_from_errno("imsg_create TREE_ENTRY");
ientries.nentries = idxN - idx0 + 1;
- if (imsg_add(wbuf, &ientries, sizeof(ientries)) == -1) {
- err = got_error_from_errno("imsg_add TREE_ENTRY");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &ientries, sizeof(ientries)) == -1)
+ return got_error_from_errno("imsg_add TREE_ENTRY");
for (i = idx0; i <= idxN; i++) {
struct got_parsed_tree_entry *pte = &entries[i];
/* Keep in sync with struct got_imsg_tree_object definition! */
- if (imsg_add(wbuf, pte->id, SHA1_DIGEST_LENGTH) == -1) {
- err = got_error_from_errno("imsg_add TREE_ENTRY");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &pte->mode, sizeof(pte->mode)) == -1) {
- err = got_error_from_errno("imsg_add TREE_ENTRY");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &pte->namelen, sizeof(pte->namelen)) == -1) {
- err = got_error_from_errno("imsg_add TREE_ENTRY");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, pte->id, SHA1_DIGEST_LENGTH) == -1)
+ return got_error_from_errno("imsg_add TREE_ENTRY");
+ if (imsg_add(wbuf, &pte->mode, sizeof(pte->mode)) == -1)
+ return got_error_from_errno("imsg_add TREE_ENTRY");
+ if (imsg_add(wbuf, &pte->namelen, sizeof(pte->namelen)) == -1)
+ return got_error_from_errno("imsg_add TREE_ENTRY");
/* Remaining bytes are the entry's name. */
- if (imsg_add(wbuf, pte->name, pte->namelen) == -1) {
- err = got_error_from_errno("imsg_add TREE_ENTRY");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, pte->name, pte->namelen) == -1)
+ return got_error_from_errno("imsg_add TREE_ENTRY");
}
wbuf->fd = -1;
got_privsep_send_commit_traversal_request(struct imsgbuf *ibuf,
struct got_object_id *id, int idx, const char *path)
{
- const struct got_error *err = NULL;
struct ibuf *wbuf;
size_t path_len = strlen(path) + 1;
if (wbuf == NULL)
return got_error_from_errno(
"imsg_create COMMIT_TRAVERSAL_REQUEST");
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
- err = got_error_from_errno("imsg_add COMMIT_TRAVERSAL_REQUEST");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &idx, sizeof(idx)) == -1) {
- err = got_error_from_errno("imsg_add COMMIT_TRAVERSAL_REQUEST");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, path, path_len) == -1) {
- err = got_error_from_errno("imsg_add COMMIT_TRAVERSAL_REQUEST");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+ return got_error_from_errno("imsg_add "
+ "COMMIT_TRAVERSAL_REQUEST");
+ if (imsg_add(wbuf, &idx, sizeof(idx)) == -1)
+ return got_error_from_errno("imsg_add "
+ "COMMIT_TRAVERSAL_REQUEST");
+ if (imsg_add(wbuf, path, path_len) == -1)
+ return got_error_from_errno("imsg_add "
+ "COMMIT_TRAVERSAL_REQUEST");
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
}
idlist.nids = nids;
- if (imsg_add(wbuf, &idlist, sizeof(idlist)) == -1) {
- err = got_error_from_errno("imsg_add OBJ_ID_LIST");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &idlist, sizeof(idlist)) == -1)
+ return got_error_from_errno("imsg_add OBJ_ID_LIST");
for (i = 0; i < nids; i++) {
struct got_object_id *id = ids[i];
- if (imsg_add(wbuf, id, sizeof(*id)) == -1) {
- err = got_error_from_errno("imsg_add OBJ_ID_LIST");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, id, sizeof(*id)) == -1)
+ return got_error_from_errno("imsg_add OBJ_ID_LIST");
}
wbuf->fd = -1;
}
ideltas.ndeltas = ndeltas;
- if (imsg_add(wbuf, &ideltas, sizeof(ideltas)) == -1) {
- err = got_error_from_errno("imsg_add REUSED_DELTAS");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &ideltas, sizeof(ideltas)) == -1)
+ return got_error_from_errno("imsg_add REUSED_DELTAS");
for (i = 0; i < ndeltas; i++) {
struct got_imsg_reused_delta *delta = &deltas[i];
- if (imsg_add(wbuf, delta, sizeof(*delta)) == -1) {
- err = got_error_from_errno("imsg_add REUSED_DELTAS");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, delta, sizeof(*delta)) == -1)
+ return got_error_from_errno("imsg_add REUSED_DELTAS");
}
wbuf->fd = -1;
blob - 8e759b6fafebc67e55310fa1e809cc93630c274a
blob + 7b6521625b84fc12679b84419662568f5f0852a1
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
static const struct got_error *
send_fetch_symrefs(struct imsgbuf *ibuf, struct got_pathlist_head *symrefs)
{
- const struct got_error *err = NULL;
struct ibuf *wbuf;
size_t len, nsymrefs = 0;
struct got_pathlist_entry *pe;
return got_error_from_errno("imsg_create FETCH_SYMREFS");
/* Keep in sync with struct got_imsg_fetch_symrefs definition! */
- if (imsg_add(wbuf, &nsymrefs, sizeof(nsymrefs)) == -1) {
- err = got_error_from_errno("imsg_add FETCH_SYMREFS");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &nsymrefs, sizeof(nsymrefs)) == -1)
+ return got_error_from_errno("imsg_add FETCH_SYMREFS");
TAILQ_FOREACH(pe, symrefs, entry) {
const char *name = pe->path;
size_t target_len = strlen(target);
/* Keep in sync with struct got_imsg_fetch_symref definition! */
- if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1) {
- err = got_error_from_errno("imsg_add FETCH_SYMREFS");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &target_len, sizeof(target_len)) == -1) {
- err = got_error_from_errno("imsg_add FETCH_SYMREFS");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, name, name_len) == -1) {
- err = got_error_from_errno("imsg_add FETCH_SYMREFS");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, target, target_len) == -1) {
- err = got_error_from_errno("imsg_add FETCH_SYMREFS");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &name_len, sizeof(name_len)) == -1)
+ return got_error_from_errno("imsg_add FETCH_SYMREFS");
+ if (imsg_add(wbuf, &target_len, sizeof(target_len)) == -1)
+ return got_error_from_errno("imsg_add FETCH_SYMREFS");
+ if (imsg_add(wbuf, name, name_len) == -1)
+ return got_error_from_errno("imsg_add FETCH_SYMREFS");
+ if (imsg_add(wbuf, target, target_len) == -1)
+ return got_error_from_errno("imsg_add FETCH_SYMREFS");
}
wbuf->fd = -1;
send_fetch_ref(struct imsgbuf *ibuf, struct got_object_id *refid,
const char *refname)
{
- const struct got_error *err = NULL;
struct ibuf *wbuf;
size_t len, reflen = strlen(refname);
return got_error_from_errno("imsg_create FETCH_REF");
/* Keep in sync with struct got_imsg_fetch_ref definition! */
- if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1) {
- err = got_error_from_errno("imsg_add FETCH_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, refname, reflen) == -1) {
- err = got_error_from_errno("imsg_add FETCH_REF");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1)
+ return got_error_from_errno("imsg_add FETCH_REF");
+ if (imsg_add(wbuf, refname, reflen) == -1)
+ return got_error_from_errno("imsg_add FETCH_REF");
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
blob - 1ccc67e3c4467f8056bf23a367d62431de5219bd
blob + 9a8444f947cbb287dff1d1c50162e40102463510
--- libexec/got-read-gitconfig/got-read-gitconfig.c
+++ libexec/got-read-gitconfig/got-read-gitconfig.c
return got_error_from_errno(
"imsg_create GITCONFIG_REMOTE");
- if (imsg_add(wbuf, &iremote, sizeof(iremote)) == -1) {
- err = got_error_from_errno(
+ if (imsg_add(wbuf, &iremote, sizeof(iremote)) == -1)
+ return got_error_from_errno(
"imsg_add GITCONFIG_REMOTE");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, remotes[i].name, iremote.name_len) == -1) {
- err = got_error_from_errno(
- "imsg_add GITCONFIG_REMOTE");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, remotes[i].fetch_url, iremote.fetch_url_len) == -1) {
- err = got_error_from_errno(
+ if (imsg_add(wbuf, remotes[i].name, iremote.name_len) == -1)
+ return got_error_from_errno(
"imsg_add GITCONFIG_REMOTE");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, remotes[i].send_url, iremote.send_url_len) == -1) {
- err = got_error_from_errno(
+ if (imsg_add(wbuf, remotes[i].fetch_url, iremote.fetch_url_len) == -1)
+ return got_error_from_errno(
"imsg_add GITCONFIG_REMOTE");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, remotes[i].send_url, iremote.send_url_len) == -1)
+ return got_error_from_errno(
+ "imsg_add GITCONFIG_REMOTE");
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
blob - 3b954345ac46a733c1c785bd2af8facdac0a4f34
blob + 6bfa6e6d2db2689f8b43a6da77858220f198e083
--- libexec/got-read-gotconfig/got-read-gotconfig.c
+++ libexec/got-read-gotconfig/got-read-gotconfig.c
if (imsg_add(wbuf, &iremote, sizeof(iremote)) == -1) {
err = got_error_from_errno(
"imsg_add GOTCONFIG_REMOTE");
- ibuf_free(wbuf);
break;
}
if (imsg_add(wbuf, repo->name, iremote.name_len) == -1) {
err = got_error_from_errno(
"imsg_add GOTCONFIG_REMOTE");
- ibuf_free(wbuf);
break;
}
if (imsg_add(wbuf, fetch_url, iremote.fetch_url_len) == -1) {
err = got_error_from_errno(
"imsg_add GOTCONFIG_REMOTE");
- ibuf_free(wbuf);
break;
}
if (imsg_add(wbuf, send_url, iremote.send_url_len) == -1) {
err = got_error_from_errno(
"imsg_add GOTCONFIG_REMOTE");
- ibuf_free(wbuf);
break;
}
blob - 0539cc8f39ad43eb386e29a32c6f6818f65b21d0
blob + ff7e4c262735bf12f8b7661425094d9ff8fdab74
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
send_traversed_commits(struct got_object_id *commit_ids, size_t ncommits,
struct imsgbuf *ibuf)
{
- const struct got_error *err;
struct ibuf *wbuf;
size_t i;
if (wbuf == NULL)
return got_error_from_errno("imsg_create TRAVERSED_COMMITS");
- if (imsg_add(wbuf, &ncommits, sizeof(ncommits)) == -1) {
- err = got_error_from_errno("imsg_add TRAVERSED_COMMITS");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &ncommits, sizeof(ncommits)) == -1)
+ return got_error_from_errno("imsg_add TRAVERSED_COMMITS");
+
for (i = 0; i < ncommits; i++) {
struct got_object_id *id = &commit_ids[i];
if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
- err = got_error_from_errno(
+ return got_error_from_errno(
"imsg_add TRAVERSED_COMMITS");
- ibuf_free(wbuf);
- return err;
}
}
blob - 5fe156dbd73077d7944f6b4957fe5738227792cb
blob + 615521693614965f7f1635a2161b3da35c245f85
--- libexec/got-send-pack/got-send-pack.c
+++ libexec/got-send-pack/got-send-pack.c
send_their_ref(struct imsgbuf *ibuf, struct got_object_id *refid,
const char *refname)
{
- const struct got_error *err = NULL;
struct ibuf *wbuf;
size_t len, reflen = strlen(refname);
return got_error_from_errno("imsg_create SEND_REMOTE_REF");
/* Keep in sync with struct got_imsg_send_remote_ref definition! */
- if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1) {
- err = got_error_from_errno("imsg_add SEND_REMOTE_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1) {
- err = got_error_from_errno("imsg_add SEND_REMOTE_REF");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, refname, reflen) == -1) {
- err = got_error_from_errno("imsg_add SEND_REMOTE_REF");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1)
+ return got_error_from_errno("imsg_add SEND_REMOTE_REF");
+ if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1)
+ return got_error_from_errno("imsg_add SEND_REMOTE_REF");
+ if (imsg_add(wbuf, refname, reflen) == -1)
+ return got_error_from_errno("imsg_add SEND_REMOTE_REF");
wbuf->fd = -1;
imsg_close(ibuf, wbuf);
send_ref_status(struct imsgbuf *ibuf, const char *refname, int success,
struct got_pathlist_head *refs, struct got_pathlist_head *delete_refs)
{
- const struct got_error *err = NULL;
struct ibuf *wbuf;
size_t len, reflen = strlen(refname);
struct got_pathlist_entry *pe;
return got_error_from_errno("imsg_create SEND_REF_STATUS");
/* Keep in sync with struct got_imsg_send_ref_status definition! */
- if (imsg_add(wbuf, &success, sizeof(success)) == -1) {
- err = got_error_from_errno("imsg_add SEND_REF_STATUS");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1) {
- err = got_error_from_errno("imsg_add SEND_REF_STATUS");
- ibuf_free(wbuf);
- return err;
- }
- if (imsg_add(wbuf, refname, reflen) == -1) {
- err = got_error_from_errno("imsg_add SEND_REF_STATUS");
- ibuf_free(wbuf);
- return err;
- }
+ if (imsg_add(wbuf, &success, sizeof(success)) == -1)
+ return got_error_from_errno("imsg_add SEND_REF_STATUS");
+ if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1)
+ return got_error_from_errno("imsg_add SEND_REF_STATUS");
+ if (imsg_add(wbuf, refname, reflen) == -1)
+ return got_error_from_errno("imsg_add SEND_REF_STATUS");
wbuf->fd = -1;
imsg_close(ibuf, wbuf);