src/nnn.c | 12 ++++++++---- diff --git a/src/nnn.c b/src/nnn.c index f7aae2350268b7b63a4af29dc3177c9bb7f30ca7..a06f4fceca99c2e2003b1b79b4e0270c14e4c438 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4954,18 +4954,22 @@ setenv(env_cfg[NNNLVL], xitoa(r), 1); return TRUE; } -static int sum_bsize(const char *UNUSED(fpath), const struct stat *sb, int UNUSED(typeflag), struct FTW *UNUSED(ftwbuf)) +static int sum_bsize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf)) { - if (sb->st_blocks && (sb->st_nlink <= 1 || test_set_bit((uint_t)sb->st_ino))) + if (sb->st_blocks + && ((typeflag == FTW_F && (sb->st_nlink <= 1 || test_set_bit((uint_t)sb->st_ino))) + || typeflag == FTW_D)) ent_blocks += sb->st_blocks; ++num_files; return 0; } -static int sum_asize(const char *UNUSED(fpath), const struct stat *sb, int UNUSED(typeflag), struct FTW *UNUSED(ftwbuf)) +static int sum_asize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf)) { - if (sb->st_size && (sb->st_nlink <= 1 || test_set_bit((uint_t)sb->st_ino))) + if (sb->st_size + && ((typeflag == FTW_F && (sb->st_nlink <= 1 || test_set_bit((uint_t)sb->st_ino))) + || typeflag == FTW_D)) ent_blocks += sb->st_size; ++num_files;