From: Yu Watanabe Date: Thu, 1 Aug 2024 02:40:20 +0000 (+0900) Subject: journalctl: fix compile error on i386 X-Git-Tag: v257-rc1~784 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8bc75089d8ecca60fa616670086c322c99b8aa5;p=thirdparty%2Fsystemd.git journalctl: fix compile error on i386 Fixes the following error: === In file included from ../src/basic/macro.h:13, from ../src/basic/dirent-util.h:8, from ../src/journal/journalctl-misc.c:3: ../src/journal/journalctl-misc.c: In function 'show_log_ids': ../src/journal/journalctl-misc.c:107:22: error: comparison is always true due to limited range of data type [-Werror=type-limits] 107 | assert(n_ids < INT64_MAX); | ^ ../src/fundamental/macro-fundamental.h:70:44: note: in definition of macro '_unlikely_' 70 | #define _unlikely_(x) (__builtin_expect(!!(x), 0)) | ^ ../src/basic/macro.h:165:22: note: in expansion of macro 'assert_message_se' 165 | #define assert(expr) assert_message_se(expr, #expr) | ^~~~~~~~~~~~~~~~~ ../src/journal/journalctl-misc.c:107:9: note: in expansion of macro 'assert' 107 | assert(n_ids < INT64_MAX); | ^~~~~~ cc1: all warnings being treated as errors === Follow-up for 0a8c1f6212a874b542a57ed5416e7d3575d2da93. --- diff --git a/src/journal/journalctl-misc.c b/src/journal/journalctl-misc.c index 01fb83807a9..5a1f3112218 100644 --- a/src/journal/journalctl-misc.c +++ b/src/journal/journalctl-misc.c @@ -104,7 +104,7 @@ static int show_log_ids(const LogId *ids, size_t n_ids, const char *name) { assert(ids); assert(n_ids > 0); - assert(n_ids < INT64_MAX); + assert((uint64_t) INT64_MAX - n_ids > 0); assert(name); table = table_new("idx", name, "first entry", "last entry");