diff options
author | Jim Meyering <meyering@redhat.com> | 2012-06-20 10:00:02 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-02 15:35:56 -0700 |
commit | 13e7f9dc6971be887fc73a460517fa84e11b927c (patch) | |
tree | 08fe333846d56c8c23b68ff2555b9f053758ccdf | |
parent | 528d94380bb9e45ebc4f09d532085476f87f32cc (diff) |
xlators/nfs: don't test/set dirpath[-1] for a zero-length name
Change-Id: Ic6ccfc964c9739f067ccf14a95fd0e09baf0dd51
BUG: 789278
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3593
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | xlators/nfs/server/src/mount3.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index 93b0864767a..e85f82ad51e 100644 --- a/xlators/nfs/server/src/mount3.c +++ b/xlators/nfs/server/src/mount3.c @@ -324,7 +324,7 @@ int mnt3_match_dirpath_export (char *expname, char *dirpath) { int ret = 0; - int dlen = 0; + size_t dlen; if ((!expname) || (!dirpath)) return 0; @@ -335,7 +335,7 @@ mnt3_match_dirpath_export (char *expname, char *dirpath) * compare. */ dlen = strlen (dirpath); - if (dirpath [dlen - 1] == '/') + if (dlen && dirpath [dlen - 1] == '/') dirpath [dlen - 1] = '\0'; if (dirpath[0] != '/') |