aboutsummaryrefslogtreecommitdiff
path: root/reftable/block.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-10-17 06:54:16 +0200
committerTaylor Blau <me@ttaylorr.com>2024-10-17 16:59:56 -0400
commit20590cd287ada9c96efdf804e2bcdac0117c01b8 (patch)
tree585b208d0bbd1263e109212cf3a78c83e2c96985 /reftable/block.c
parent591c6a600e0ef1bfc71d66d74b64bf47de62fc8e (diff)
downloadgit-20590cd287ada9c96efdf804e2bcdac0117c01b8.tar.xz
reftable: handle trivial `reftable_buf` errors
Convert the reftable library such that we handle failures with the new `reftable_buf` interfaces. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'reftable/block.c')
-rw-r--r--reftable/block.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/reftable/block.c b/reftable/block.c
index 697b8b4153..f5b432566a 100644
--- a/reftable/block.c
+++ b/reftable/block.c
@@ -40,7 +40,9 @@ int footer_size(int version)
static int block_writer_register_restart(struct block_writer *w, int n,
int is_restart, struct reftable_buf *key)
{
- int rlen = w->restart_len;
+ int rlen, err;
+
+ rlen = w->restart_len;
if (rlen >= MAX_RESTARTS) {
is_restart = 0;
}
@@ -60,7 +62,10 @@ static int block_writer_register_restart(struct block_writer *w, int n,
w->next += n;
reftable_buf_reset(&w->last_key);
- reftable_buf_add(&w->last_key, key->buf, key->len);
+ err = reftable_buf_add(&w->last_key, key->buf, key->len);
+ if (err < 0)
+ return err;
+
w->entries++;
return 0;
}