summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2015-02-25 16:47:56 -0500
committerSteve Dickson <steved@redhat.com>2015-02-26 14:34:00 -0500
commit1e4a4c3816ca5a1e1a345117a201d9cc6c468beb (patch)
treea71100ce4c4ccb489f4e652b964a7cdf568fc6f4
parentcb80ee2db749a19814d1851a05c6bfa81f98d71d (diff)
downloadnfs-utils-1e4a4c3816ca5a1e1a345117a201d9cc6c468beb.tar.gz
nfs-utils-1e4a4c3816ca5a1e1a345117a201d9cc6c468beb.tar.xz
nfs-utils-1e4a4c3816ca5a1e1a345117a201d9cc6c468beb.zip
mountd: fix next_mnt handling for "/"
If the (exported) path passed to next_mnt() is simply "/", next_mnt() will not report any children, as none start with "/" followed by a '/'. So make a special case for strlen(p)==1. In that case, return all children. This gives correct handling if only "/" is exported. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/mountd/cache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index c23d384..7d250f9 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -376,7 +376,7 @@ static char *next_mnt(void **v, char *p)
*v = f;
} else
f = *v;
- while ((me = getmntent(f)) != NULL &&
+ while ((me = getmntent(f)) != NULL && l > 1 &&
(strncmp(me->mnt_dir, p, l) != 0 ||
me->mnt_dir[l] != '/'))
;