diff options
author | Jim Meyering <jim@meyering.net> | 2003-07-09 10:00:42 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-07-09 10:00:42 +0000 |
commit | 859428bfaae6efbc911b0585b7ceb17ad24ac9a3 (patch) | |
tree | ad2a9400f655a0cf755b612ac7a5fb6b5e0901e3 /lib | |
parent | 4ad6473e4f0ff2575efd219e8a884c088c479a2e (diff) | |
download | coreutils-859428bfaae6efbc911b0585b7ceb17ad24ac9a3.tar.xz |
Fix the bug that would make `du /' omit the `/' on the last line.
E.g., `du --exclude '[^/]*' -x /' would print only "4\t\n" for me.
(ftw_dir): Don't clobber the leading `/'.
Reported by Chris Lesniewski as http://bugs.debian.org/200542.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftw.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -605,8 +605,9 @@ ftw_dir (struct ftw_data *data, struct FTW_STAT *st) __set_errno (save_err); } - /* Prepare the return, revert the `struct FTW' information. */ - data->dirbuf[data->ftw.base - 1] = '\0'; + /* Prepare the return, revert the `struct FTW' information. + If ftw.base is 1, be careful to preserve the `/'. */ + data->dirbuf[data->ftw.base == 1 ? 1 : data->ftw.base - 1] = '\0'; --data->ftw.level; data->ftw.base = previous_base; |