summaryrefslogtreecommitdiffstats
path: root/cli/src/cli.c
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2012-05-10 16:24:45 +0530
committerAnand Avati <avati@redhat.com>2012-05-22 00:53:12 -0700
commitfa287178ac714071ceacf8697bd36cc8a8a8da00 (patch)
tree684f2e2fc6527c8873f395704d5b799146383837 /cli/src/cli.c
parentbb2fc0a23e46413a14baef1846a9873681d32fe2 (diff)
core: canonicalize paths
canonicalize paths during add-brick, creation of volume, setting nfs.export-dir in volgen BUG: 789870 Change-Id: I1d3788ac850359b0def0457113831e825a475d58 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/3315 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli/src/cli.c')
-rw-r--r--cli/src/cli.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 6a5ecf698..89b5a8bd4 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -577,70 +577,6 @@ cli_local_wipe (cli_local_t *local)
return;
}
-/* If the path exists use realpath(3) to handle extra slashes and to resolve
- * symlinks else strip the extra slashes in the path and return */
-
-int
-cli_canonicalize_path (char *path)
-{
- struct stat sb = {0};
- int ret = -1;
- char *tmppath = NULL;
- char *dir = NULL;
- char *tmpstr = NULL;
- int path_len = 0;
-
- if (!path)
- return ret;
-
- ret = stat (path, &sb);
- if (ret == -1) {
- /* Strip the extra slashes and return */
- tmppath = gf_strdup (path);
- if (tmppath == NULL) {
- ret = -1;
- gf_log ("cli", GF_LOG_ERROR, "Out of memory.");
- goto out;
- }
- bzero (path, strlen(path));
- path[0] = '/';
- dir = strtok_r(tmppath, "/", &tmpstr);
- while (dir) {
- strncpy ((path + path_len + 1), dir, strlen(dir));
- path_len = strlen (path);
- dir = strtok_r(NULL, "/", &tmpstr);
- if (dir)
- strncpy((path + path_len), "/", 1);
- }
- if (path_len == 0)
- path[1] = '\0';
- else
- path[path_len] = '\0';
- ret = 0;
- goto out;
- } else {
- tmppath = gf_strdup(path);
- if (tmppath == NULL) {
- ret = -1;
- gf_log ("cli", GF_LOG_ERROR, "Out of memory.");
- goto out;
- }
- if (realpath (tmppath, path) == NULL) {
- cli_out ("Path manipulation failed: %s",
- strerror(errno));
- gf_log ("cli", GF_LOG_ERROR, "Path manipulation "
- "failed: %s", strerror(errno));
- ret = -1;
- goto out;
- }
- ret = 0;
- }
-out:
- if (tmppath)
- GF_FREE(tmppath);
- return ret;
-}
-
struct cli_state *global_state;
int