diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2010-09-21 10:49:49 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-21 10:41:13 -0700 |
commit | eb8561e302bd83305fb093eb8cca42b4f9f62b22 (patch) | |
tree | 1432eb8e9add9b6b029aaedbc0939d8960a70b80 /cli/src/cli.c | |
parent | bd1fa94c8e26cb34566ad460092c2089597e2b17 (diff) |
cli: remove trailing slashes from brick paths
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1659 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1659
Diffstat (limited to 'cli/src/cli.c')
-rw-r--r-- | cli/src/cli.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c index 8730211bff9..a08d2d214d7 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -495,6 +495,26 @@ cli_local_wipe (cli_local_t *local) return; } +void +cli_path_strip_trailing_slashes (char *path) +{ + int i = 0; + int len = 0; + + if (!path) + return; + + len = strlen (path); + for (i = len - 1; i > 0 ; i--) { + if (path[i] != '/') + break; + + } + + if (i < (len - 1)) + path[i + 1] = '\0'; +} + struct cli_state *global_state; int |