Only call recurse() when path points to a directory in du(1)
This improves performance by ~30%.
This commit is contained in:
parent
af61ba738c
commit
3b187f4826
1
du.c
1
du.c
|
@ -47,6 +47,7 @@ du(const char *path, int depth, void *total)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (S_ISDIR(st.st_mode))
|
||||||
recurse(path, du, depth, &subtotal);
|
recurse(path, du, depth, &subtotal);
|
||||||
*((size_t *)total) += subtotal + nblks(st.st_blocks);
|
*((size_t *)total) += subtotal + nblks(st.st_blocks);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user