On 04/07/2026 00:33, Collin Funk wrote:
I was going to push this test, but then I realized this behavior was
probably an unintentional consequence of Paul's commit to prefer
signed types [1]. So perhaps it is better to check that --max-depth is
positive, i.e., make this change instead:

diff --git a/src/du.c b/src/du.c
index bff1b6672..8d99c4265 100644
--- a/src/du.c
+++ b/src/du.c
@@ -860,7 +860,7 @@ main (int argc, char **argv)
            {
              intmax_t tmp;
              if (xstrtoimax (optarg, NULL, 0, &tmp, "") == LONGINT_OK
-                && tmp <= IDX_MAX)
+                && 0 <= tmp && tmp <= IDX_MAX)
                {
                  max_depth_specified = true;
                  max_depth = tmp;

Thoughts?

Yes I think this is better.
It would be confusing to allow negative values here.
Also find -maxdepth disallows negative values.

cheers,
Padraig

Reply via email to