From: Lennart Poettering Date: Thu, 25 Oct 2018 15:40:41 +0000 (+0200) Subject: journal: fix some type confusion in journal_directory_vacuum() X-Git-Tag: v240~467^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=180e7f4e628ad8829b815d69f0b0d9ce1eee5dec;p=thirdparty%2Fsystemd.git journal: fix some type confusion in journal_directory_vacuum() Let's store array sizes and indexes in size_t. And let's count numbers of files in uint64_t (simply because that is the type of the input parameter for this of the function) --- diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c index fdf7b8883fa..2778ce40c58 100644 --- a/src/journal/journal-vacuum.c +++ b/src/journal/journal-vacuum.c @@ -126,11 +126,10 @@ int journal_directory_vacuum( usec_t *oldest_usec, bool verbose) { + uint64_t sum = 0, freed = 0, n_active_files = 0; + size_t n_list = 0, n_allocated = 0, i; _cleanup_closedir_ DIR *d = NULL; struct vacuum_info *list = NULL; - unsigned n_list = 0, i, n_active_files = 0; - size_t n_allocated = 0; - uint64_t sum = 0, freed = 0; usec_t retention_limit = 0; char sbytes[FORMAT_BYTES_MAX]; struct dirent *de; @@ -283,7 +282,7 @@ int journal_directory_vacuum( typesafe_qsort(list, n_list, vacuum_compare); for (i = 0; i < n_list; i++) { - unsigned left; + uint64_t left; left = n_active_files + n_list - i;