From 1e4a4c3816ca5a1e1a345117a201d9cc6c468beb Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 25 Feb 2015 16:47:56 -0500 Subject: 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 Signed-off-by: Steve Dickson --- utils/mountd/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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] != '/')) ; -- cgit