summaryrefslogtreecommitdiff
path: root/src/readahead/readahead-analyze.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/readahead/readahead-analyze.c')
-rw-r--r--src/readahead/readahead-analyze.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/readahead/readahead-analyze.c b/src/readahead/readahead-analyze.c
index 9a929c0937..76db3cb7e4 100644
--- a/src/readahead/readahead-analyze.c
+++ b/src/readahead/readahead-analyze.c
@@ -34,10 +34,10 @@
int main_analyze(const char *pack_path) {
char line[LINE_MAX];
- FILE *pack;
+ _cleanup_fclose_ FILE *pack = NULL;
int a;
int missing = 0;
- off_t tsize = 0;
+ size_t tsize = 0;
if (!pack_path)
pack_path = "/.readahead";
@@ -114,11 +114,11 @@ int main_analyze(const char *pack_path) {
tsize += size;
- printf(" %4d%% (%2d) %12ld: %s\n",
- sections ? (int) (size * 100 / st.st_size) : 100,
- sections ? sections : 1,
- (unsigned long)size,
- path);
+ printf(" %4jd%% (%2d) %12jd: %s\n",
+ (intmax_t) (sections && st.st_size ? size * 100 / st.st_size : 100),
+ sections ? sections : 1,
+ (intmax_t) size,
+ path);
} else {
printf(" %4dp (%2d) %12s: %s (MISSING)\n",
sections ? pages : -1,
@@ -130,21 +130,17 @@ int main_analyze(const char *pack_path) {
}
- fclose(pack);
-
printf("\nHOST: %s"
"TYPE: %c\n"
"MISSING: %d\n"
- "TOTAL: %llu\n",
+ "TOTAL: %zu\n",
line,
a,
missing,
- (unsigned long long) tsize);
+ tsize);
return EXIT_SUCCESS;
fail:
- if(pack)
- fclose(pack);
return EXIT_FAILURE;
}