From 9297df4e48c45123a5e4103b3fd07df244346636 Mon Sep 17 00:00:00 2001 From: Chrissie Caulfield Date: Wed, 15 Nov 2023 09:03:52 +0000 Subject: [PATCH] Change assert in ringbuffer to a return code (#492) Why just this one? There are LOADS of asserts in libqb, some are OK and some may be overkill. This one in particular is causing CI failures and so annoys me more than the rest. --- lib/ringbuffer_helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ringbuffer_helper.c b/lib/ringbuffer_helper.c index dbde275..11795ff 100644 --- a/lib/ringbuffer_helper.c +++ b/lib/ringbuffer_helper.c @@ -359,7 +359,11 @@ qb_rb_close_helper(struct qb_ringbuffer_s * rb, int32_t unlink_it, truncate_fallback); /* the dirname part is assumed to be the same */ - assert(!strncmp(dir_path, hdr_path, sep - data_path)); + if (strncmp(dir_path, hdr_path, sep - data_path)) { + qb_util_perror(LOG_DEBUG, + "header path is corrupted: %s", hdr_path); + res = -ENXIO; + } sep = hdr_path + (sep - data_path); /* now, don't touch neither data_path nor hdr_path */ -- 2.33.0