chiark / gitweb /
Do not log all assert_return failures
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Dec 2013 01:34:19 +0000 (20:34 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Dec 2013 03:26:55 +0000 (22:26 -0500)
% build/journalctl help
Assertion 'match_is_valid(data, size)' failed at ../src/journal/sd-journal.c:227, function sd_journal_add_match(). Ignoring.

Callers cannot be expect to check all arguments always.

src/shared/log.c

index 2531e0da0376cbba486e12fa243f73a70103b4f6..c654b862284a70449e96384242fccbbd43c564e6 100644 (file)
@@ -690,6 +690,9 @@ int log_meta_object(
 static void log_assert(int level, const char *text, const char *file, int line, const char *func, const char *format) {
         static char buffer[LINE_MAX];
 
+        if (_likely_(LOG_PRI(level) > log_max_level))
+                return;
+
         snprintf(buffer, sizeof(buffer), format, text, file, line, func);
 
         char_array_0(buffer);