Skip to contentSkip to conversation

nfs-utils: fix CROSSMOUNT test in utils/mountd/cache.c

PATCH New Frank Filz 1 participant 1 message Jan 31, 2008

Subsystems (2)
lore
Share & tools
lore

Frank Filz

author
#0 lore raw

PATCH 1/1 nfs-utils: fix CROSSMOUNT test in utils/mountd/cache.c

While debugging problems with nfs-utils, I noticed the following bit of code:

			/* If one is a CROSSMOUNT, then prefer the longest path */
			if (((found->m_export.e_flags & NFSEXP_CROSSMOUNT) ||
			     (found->m_export.e_flags & NFSEXP_CROSSMOUNT)) &&
			    strlen(found->m_export.e_path) !=
			    strlen(found->m_export.e_path)) {

This will never actually be hit since the two strlens are always the same!

Here is a simple patch to fix this to what I assume the intent was:

utils/mountd/cache.c renamed from utils/mountd/cache.c.orig +2 -2
@@ -708,9 +708,9 @@ void nfsd_export(FILE *f)
 			}
 			/* If one is a CROSSMOUNT, then prefer the longest path */
 			if (((found->m_export.e_flags & NFSEXP_CROSSMOUNT) ||
-			     (found->m_export.e_flags & NFSEXP_CROSSMOUNT)) &&
+			     (exp->m_export.e_flags & NFSEXP_CROSSMOUNT)) &&
 			    strlen(found->m_export.e_path) !=
-			    strlen(found->m_export.e_path)) {
+			    strlen(exp->m_export.e_path)) {
 
 				if (strlen(exp->m_export.e_path) >
 				    strlen(found->m_export.e_path)) {

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
_______________________________________________
Please note that [email protected] is being discontinued. Please subscribe to [email protected] instead.
http://vger.kernel.org/vger-lists.html#linux-nfs