From: Patrick Steinhardt Date: Mon, 13 May 2024 08:18:09 +0000 (+0200) Subject: reftable/writer: improve error when passed an invalid block size X-Git-Tag: v2.46.0-rc0~91^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c22d75b02784baa1713e0c007fcd0cb675dd9f43;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/reftable/writer.c b/reftable/writer.c index a043025b01..45b3e9ce1f 100644 --- a/reftable/writer.c +++ b/reftable/writer.c @@ -128,10 +128,8 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t), if (_opts) opts = *_opts; options_set_defaults(&opts); - if (opts.block_size >= (1 << 24)) { - /* TODO - error return? */ - abort(); - } + if (opts.block_size >= (1 << 24)) + BUG("configured block size exceeds 16MB"); strbuf_init(&wp->block_writer_data.last_key, 0); strbuf_init(&wp->last_key, 0);