* [PATCH - nfs-utils] mountd: fix next_mnt handling for "/"
@ 2015-02-16 1:18 NeilBrown
2015-02-26 19:37 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: NeilBrown @ 2015-02-16 1:18 UTC (permalink / raw)
To: Steve Dickson, NFS
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
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>
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index c23d384d24eb..ac36b6d9f21e 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -377,6 +377,7 @@ static char *next_mnt(void **v, char *p)
} else
f = *v;
while ((me = getmntent(f)) != NULL &&
+ l > 1 &&
(strncmp(me->mnt_dir, p, l) != 0 ||
me->mnt_dir[l] != '/'))
;
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH - nfs-utils] mountd: fix next_mnt handling for "/"
2015-02-16 1:18 [PATCH - nfs-utils] mountd: fix next_mnt handling for "/" NeilBrown
@ 2015-02-26 19:37 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2015-02-26 19:37 UTC (permalink / raw)
To: NeilBrown, NFS
On 02/15/2015 08:18 PM, NeilBrown wrote:
>
>
> 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>
Committed!
steved.
>
> diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> index c23d384d24eb..ac36b6d9f21e 100644
> --- a/utils/mountd/cache.c
> +++ b/utils/mountd/cache.c
> @@ -377,6 +377,7 @@ static char *next_mnt(void **v, char *p)
> } else
> f = *v;
> while ((me = getmntent(f)) != NULL &&
> + l > 1 &&
> (strncmp(me->mnt_dir, p, l) != 0 ||
> me->mnt_dir[l] != '/'))
> ;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-26 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-16 1:18 [PATCH - nfs-utils] mountd: fix next_mnt handling for "/" NeilBrown
2015-02-26 19:37 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).