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
This commit is contained in:
Richard Ipsum 2020-06-03 12:45:15 +01:00 committed by Michael Forney
parent 9e985c2bb2
commit 5c76e79f41
1 changed files with 2 additions and 0 deletions

View File

@ -90,6 +90,8 @@ recurse(int dirfd, const char *name, void *data, struct recursor *r)
r->depth--; r->depth--;
} }
} }
r->path[pathlen - 1] = '\0';
r->pathlen = pathlen - 1;
closedir(dp); closedir(dp);
} }