From a33380068a9ab9eea80a6d0b6207d9e3cc9bdff4 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 18 Nov 2009 01:16:01 +0000 Subject: 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 Signed-off-by: Anand V. Avati BUG: 369 (Samba does not work with booster.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=369 --- libglusterfsclient/src/libglusterfsclient.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'libglusterfsclient') diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index dcfda772e11..179f2c217a7 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; } -- cgit