mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Fix regression in calculating apparent du for dirs
This commit is contained in:
parent
1fbaa61052
commit
0cb5ddf3f1
20
src/nnn.c
20
src/nnn.c
|
@ -4237,7 +4237,7 @@ static int sum_bsize(const char *UNUSED(fpath), const struct stat *sb, int typef
|
||||||
static int sum_asize(const char *UNUSED(fpath), const struct stat *sb, int 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 && (typeflag == FTW_D
|
if (sb->st_size && (typeflag == FTW_D
|
||||||
|| (typeflag == FTW_D && (sb->st_nlink <= 1 || test_set_bit((uint)sb->st_ino)))))
|
|| (typeflag == FTW_F && (sb->st_nlink <= 1 || test_set_bit((uint)sb->st_ino)))))
|
||||||
ent_blocks += sb->st_size;
|
ent_blocks += sb->st_size;
|
||||||
|
|
||||||
++num_files;
|
++num_files;
|
||||||
|
@ -4660,15 +4660,6 @@ static bool set_sort_flags(void)
|
||||||
entrycmpfn = &entrycmp;
|
entrycmpfn = &entrycmp;
|
||||||
|
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case 'c':
|
|
||||||
cfg.mtimeorder = 0;
|
|
||||||
cfg.sizeorder = 0;
|
|
||||||
cfg.apparentsz = 0;
|
|
||||||
cfg.blkorder = 0;
|
|
||||||
cfg.extnorder = 0;
|
|
||||||
entrycmpfn = &entrycmp;
|
|
||||||
namecmpfn = &xstricmp;
|
|
||||||
break;
|
|
||||||
case 'a': /* Apparent du */
|
case 'a': /* Apparent du */
|
||||||
cfg.apparentsz ^= 1;
|
cfg.apparentsz ^= 1;
|
||||||
if (cfg.apparentsz) {
|
if (cfg.apparentsz) {
|
||||||
|
@ -4697,6 +4688,15 @@ static bool set_sort_flags(void)
|
||||||
clearfilter(); /* Reload directory */
|
clearfilter(); /* Reload directory */
|
||||||
endselection(); /* We are going to reload dir */
|
endselection(); /* We are going to reload dir */
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
cfg.mtimeorder = 0;
|
||||||
|
cfg.sizeorder = 0;
|
||||||
|
cfg.apparentsz = 0;
|
||||||
|
cfg.blkorder = 0;
|
||||||
|
cfg.extnorder = 0;
|
||||||
|
entrycmpfn = &entrycmp;
|
||||||
|
namecmpfn = &xstricmp;
|
||||||
|
break;
|
||||||
case 'e': /* File extension */
|
case 'e': /* File extension */
|
||||||
cfg.extnorder ^= 1;
|
cfg.extnorder ^= 1;
|
||||||
cfg.sizeorder = 0;
|
cfg.sizeorder = 0;
|
||||||
|
|
Loading…
Reference in a new issue