Makes deciding which function to use for summing file data happen once in main instead of for each file. Signed-off-by: Arvind Raghavan <raghavan.arvind@xxxxxxxxx> Signed-off-by: Jayashree Mohan <jaya@xxxxxxxxxxxxx> Signed-off-by: Vijay Chidambaram <vijay@xxxxxxxxxxxxx> --- Moved into separate patch as per Amir's suggestion. src/fssum.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fssum.c b/src/fssum.c index 3d97a70b..30f456c2 100644 --- a/src/fssum.c +++ b/src/fssum.c @@ -62,6 +62,7 @@ int n_excludes = 0; int verbose = 0; FILE *out_fp; FILE *in_fp; +sum_file_data_t sum_file_data; enum _flags { FLAG_UID, @@ -514,8 +515,6 @@ sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in) int ret; int fd; int excl; - sum_file_data_t sum_file_data = flags[FLAG_STRUCTURE] ? - sum_file_data_strict : sum_file_data_permissive; struct stat64 dir_st; if (fstat64(dirfd, &dir_st)) { @@ -824,6 +823,9 @@ main(int argc, char *argv[]) flagstring[i] -= 'a' - 'A'; } + sum_file_data = flags[FLAG_STRUCTURE] ? + sum_file_data_strict : sum_file_data_permissive; + path = argv[optind]; plen = strlen(path); if (path[plen - 1] == '/') { -- 2.20.1