]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: use right type 'size_t' for counting memory
authorLennart Poettering <lennart@poettering.net>
Sun, 17 Jan 2021 13:43:17 +0000 (14:43 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 Jan 2021 16:17:27 +0000 (01:17 +0900)
Follow-up for e363b0e4fc4f32225034a11dd53c0cc68747ba6e

(Mostly a theoretical fix. On 64bit systems unsigned is 32bit, and we
had more than 2^32 units thing would fall apart here.)

src/systemctl/systemctl-list-units.c

index cf6ad4a95fe91bc852e17d4a33d8edea4beb4859..7f0e79eedd6c34242c5d38d777c9299652d9875f 100644 (file)
@@ -109,7 +109,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
 
         (void) table_set_empty_string(table, "-");
 
-        for (const UnitInfo *u = unit_infos; unit_infos && (unsigned)(u - unit_infos) < c; u++) {
+        for (const UnitInfo *u = unit_infos; unit_infos && (size_t) (u - unit_infos) < c; u++) {
                 _cleanup_free_ char *j = NULL;
                 const char *on_underline = "", *on_loaded = "", *on_active = "";
                 const char *on_circle = "", *id;