summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 3143a13ed4f..3881ad64296 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -7806,7 +7806,7 @@ libgf_client_chdir (const char *path)
{
if (!libgf_path_absolute (path)) {
resulting_cwd_len = strlen (path) + strlen (cwd)
- + ((path[strlen (path) - 1] == '/')
+ + ((strlen (path) && path[strlen (path) - 1] == '/')
? 0 : 1) + 1;
if (resulting_cwd_len > PATH_MAX) {