diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-11-18 01:16:01 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-11-18 21:14:12 -0800 |
commit | a33380068a9ab9eea80a6d0b6207d9e3cc9bdff4 (patch) | |
tree | 88a91e71c6faf59f5e59a9770263875129885828 | |
parent | eb4043706c901f8609e65c9a35463ea3f7e2c569 (diff) |
libglusterfsclient: fix libgf_vmp_virtual_path. - This procedure used to return garbage as virtual path if the path happens to be exact mount point but without the trailing slash and the vmp had a trailing slash.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 369 (Samba does not work with booster.)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=369
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index dcfda772e..179f2c217 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -91,19 +91,22 @@ static char cwd_inited = 0; static pthread_mutex_t cwdlock = PTHREAD_MUTEX_INITIALIZER; char * -libgf_vmp_virtual_path(struct vmp_entry *entry, char *path, char *vpath) +libgf_vmp_virtual_path (struct vmp_entry *entry, const char *path, char *vpath) { char *tmp = NULL; - if ((!entry) || (!path) || (!vpath)) - return NULL; - tmp = ((char *)(path + (entry->vmplen-1))); - if (tmp[0] != '/') { + if (strlen (tmp) > 0) { + if (tmp[0] != '/') { + vpath[0] = '/'; + vpath[1] = '\0'; + strcat (&vpath[1], tmp); + } else + strcpy (vpath, tmp); + } else { vpath[0] = '/'; - strcat (&vpath[1], tmp); - } else - strcpy (vpath, tmp); + vpath[1] = '\0'; + } return vpath; } |