commit 5c76e79f41250d505bca09d36a5518bf66c51749
parent 9e985c2bb2afea0f7fcd221b0359201cb121296d
Author: Richard Ipsum <richardipsum@vx21.xyz>
Date: Wed, 3 Jun 2020 12:45:15 +0100
du: recurse: fix path
path is not fixed up on exit from recursive step, this leads to
incorrect paths in du's output.
% find D
D
D/E
D/E/F
D/E/F/a2
D/E/F/b2
D/E/a1
D/E/b1
D/a
D/b
% du D
4 D/E/F
8 D/E
12 D
% ~/sbase/du D
4 D/E/F/b2
8 D/E/b1
12 D
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/libutil/recurse.c b/libutil/recurse.c
@@ -90,6 +90,8 @@ recurse(int dirfd, const char *name, void *data, struct recursor *r)
r->depth--;
}
}
+ r->path[pathlen - 1] = '\0';
+ r->pathlen = pathlen - 1;
closedir(dp);
}