git: 0ae2b9e866d3 - main - du: Fix threshold on non-directory files

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 28 Apr 2025 18:21:14 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=0ae2b9e866d3aea1e9141841488561f12603f879

commit 0ae2b9e866d3aea1e9141841488561f12603f879
Author:     Michal Scigocki <michal.os@hotmail.com>
AuthorDate: 2025-04-07 11:14:44 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-04-28 18:20:37 +0000

    du: Fix threshold on non-directory files
    
    PR:             265200
    Reviewed by:    markj
    MFC after:      1 month
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1648
---
 usr.bin/du/du.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 185a5cbe4465..5b71ceeb531f 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -322,7 +322,9 @@ main(int argc, char *argv[])
 			    howmany(p->fts_statp->st_size, cblocksize) :
 			    howmany(p->fts_statp->st_blocks, cblocksize);
 
-			if (aflag || p->fts_level == 0) {
+			if ((aflag || p->fts_level == 0) && threshold <=
+			    threshold_sign * howmany(curblocks * cblocksize,
+			    blocksize)) {
 				xo_open_instance("paths");
 				if (hflag > 0) {
 					prthumanval("{:blocks/%4s}", curblocks);