diff mbox series

[v2,1/3] mountd: Fix up incorrect comparison in next_mnt()

Message ID 20190604175734.98657-2-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series Incremental against [exports] rootdir patchset | expand

Commit Message

Trond Myklebust June 4, 2019, 5:57 p.m. UTC
We want to ensure that we compare the full name of the last component.

Reported-by: "J. Bruce Fields" <bfields@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 utils/mountd/cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index d818c971bded..d616d526667e 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -400,7 +400,7 @@  static char *next_mnt(void **v, char *p)
 	while ((me = getmntent(f)) != NULL && l > 1) {
 		mnt_dir = nfsd_path_strip_root(me->mnt_dir);
 
-		if (strncmp(mnt_dir, p, l) == 0 && mnt_dir[l] != '/')
+		if (strncmp(mnt_dir, p, l) == 0 && mnt_dir[l] == '/')
 			return mnt_dir;
 	}
 	endmntent(f);