Skip to content

Commit c22d75b

Browse files
pks-tgitster
authored andcommitted
reftable/writer: improve error when passed an invalid block size
The reftable format only supports block sizes up to 16MB. When the writer is being passed a value bigger than that it simply calls abort(3P), which isn't all that helpful due to the lack of a proper error message. Improve this by calling `BUG()` instead. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e0cf3d8 commit c22d75b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

reftable/writer.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
128128
if (_opts)
129129
opts = *_opts;
130130
options_set_defaults(&opts);
131-
if (opts.block_size >= (1 << 24)) {
132-
/* TODO - error return? */
133-
abort();
134-
}
131+
if (opts.block_size >= (1 << 24))
132+
BUG("configured block size exceeds 16MB");
135133

136134
strbuf_init(&wp->block_writer_data.last_key, 0);
137135
strbuf_init(&wp->last_key, 0);

0 commit comments

Comments
 (0)