[PATCH 04/11] reftable/writer: improve error when passed an invalid block size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 reftable/writer.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/reftable/writer.c b/reftable/writer.c
index 7df6e53699..374b7d15ed 100644
--- a/reftable/writer.c
+++ b/reftable/writer.c
@@ -125,10 +125,8 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
 	struct reftable_writer *wp = reftable_calloc(1, sizeof(*wp));
 
 	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);
-- 
2.45.0

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux