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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e0cf3d8f8b
commit
c22d75b027
@ -128,10 +128,8 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
|
|||||||
if (_opts)
|
if (_opts)
|
||||||
opts = *_opts;
|
opts = *_opts;
|
||||||
options_set_defaults(&opts);
|
options_set_defaults(&opts);
|
||||||
if (opts.block_size >= (1 << 24)) {
|
if (opts.block_size >= (1 << 24))
|
||||||
/* TODO - error return? */
|
BUG("configured block size exceeds 16MB");
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
strbuf_init(&wp->block_writer_data.last_key, 0);
|
strbuf_init(&wp->block_writer_data.last_key, 0);
|
||||||
strbuf_init(&wp->last_key, 0);
|
strbuf_init(&wp->last_key, 0);
|
||||||
|
Reference in New Issue
Block a user