Also remove a few casts and use _cleanup_fclose_ to simplify logic.
int main_analyze(const char *pack_path) {
char line[LINE_MAX];
int main_analyze(const char *pack_path) {
char line[LINE_MAX];
+ FILE _cleanup_fclose_ *pack = NULL;
if (!pack_path)
pack_path = "/.readahead";
if (!pack_path)
pack_path = "/.readahead";
}
if (stat(path, &st) == 0) {
}
if (stat(path, &st) == 0) {
if (sections == 0)
size = st.st_size;
if (sections == 0)
size = st.st_size;
- printf(" %4d%% (%2d) %12ld: %s\n",
- sections ? (int) (size * 100 / st.st_size) : 100,
+ printf(" %4zd%% (%2d) %12zd: %s\n",
+ sections && st.st_size ? size * 100 / st.st_size : 100,
path);
} else {
printf(" %4dp (%2d) %12s: %s (MISSING)\n",
path);
} else {
printf(" %4dp (%2d) %12s: %s (MISSING)\n",
printf("\nHOST: %s"
"TYPE: %c\n"
"MISSING: %d\n"
printf("\nHOST: %s"
"TYPE: %c\n"
"MISSING: %d\n"
- (unsigned long long) tsize);
return EXIT_SUCCESS;
fail:
return EXIT_SUCCESS;
fail:
- if(pack)
- fclose(pack);