diff options
author | Gu Jinxiang <gujx@cn.fujitsu.com> | 2018-03-29 17:11:19 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-04-24 13:00:11 +0200 |
commit | a5ef445f05fb077736d47624e31b9f6c7bbb0f1b (patch) | |
tree | 4ab3c904048b651b665887440392116028b1dce6 | |
parent | 5f53c23e7676e9fafb78fa166e3f00e143b5a2c5 (diff) | |
download | btrfs-progs-a5ef445f05fb077736d47624e31b9f6c7bbb0f1b.tar.gz btrfs-progs-a5ef445f05fb077736d47624e31b9f6c7bbb0f1b.tar.bz2 btrfs-progs-a5ef445f05fb077736d47624e31b9f6c7bbb0f1b.zip |
btrfs-progs: Do not add extra slash if given path end with it
When use a given path end with a slash like below,
the output of path will have double slash.
Do not add extra slash if there is already one in the given
path.
$ btrfs filesystem du ./test/
output:
Total Exclusive Set shared Filename
0.00B 0.00B - /home/gujx/device/tmp/test//foo
Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | cmds-fi-du.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds-fi-du.c b/cmds-fi-du.c index 8a44665c..7e6bb7f6 100644 --- a/cmds-fi-du.c +++ b/cmds-fi-du.c @@ -449,7 +449,7 @@ static int du_add_file(const char *filename, int dirfd, } pathtmp = pathp; - if (pathp == path) + if (pathp == path || *(pathp - 1) == '/') ret = sprintf(pathp, "%s", filename); else ret = sprintf(pathp, "/%s", filename); |