From: Frantisek Sumsal Date: Wed, 15 Nov 2023 12:38:02 +0000 (+0100) Subject: sd-journal: don't treat invalid match as a programming error X-Git-Tag: v255-rc2~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17122c3de1c60080bfbb190253e3aee653247082;p=thirdparty%2Fsystemd.git sd-journal: don't treat invalid match as a programming error Don't use assert_runtime() when we get an invalid match string, since that's a runtime error: $ SYSTEMD_LOG_LEVEL=debug coredumpctl info = ... Adding match: = Assertion 'match_is_valid(data, size)' failed at src/libsystemd/sd-journal/sd-journal.c:240, function sd_journal_add_match(). Ignoring. Failed to add match "=": Invalid argument --- diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index 73a65da7502..eb35b9d9c47 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -235,7 +235,8 @@ _public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size) if (size == 0) size = strlen(data); - assert_return(match_is_valid(data, size), -EINVAL); + if (!match_is_valid(data, size)) + return -EINVAL; /* level 0: AND term * level 1: OR terms