Fixed the usage of strcmp in the duplicate check in insert groups. Fixes an
issue with showmount and other commands that required the group information.
Signed-off-by: Matthew Treinish <[email protected]>
---
utils/mountd/mountd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 035624c..bcf5080 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -633,7 +633,7 @@ static void insert_group(struct exportnode *e, char *newname)
struct groupnode *g;
for (g = e->ex_groups; g; g = g->gr_next)
- if (strcmp(g->gr_name, newname))
+ if (!strcmp(g->gr_name, newname))
return;
g = xmalloc(sizeof(*g));
--
1.7.4.4
On 08/01/2011 03:02 PM, Matthew Treinish wrote:
> Fixed the usage of strcmp in the duplicate check in insert groups. Fixes an
> issue with showmount and other commands that required the group information.
>
> Signed-off-by: Matthew Treinish <[email protected]>
Committed...
steved.
> ---
> utils/mountd/mountd.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
> index 035624c..bcf5080 100644
> --- a/utils/mountd/mountd.c
> +++ b/utils/mountd/mountd.c
> @@ -633,7 +633,7 @@ static void insert_group(struct exportnode *e, char *newname)
> struct groupnode *g;
>
> for (g = e->ex_groups; g; g = g->gr_next)
> - if (strcmp(g->gr_name, newname))
> + if (!strcmp(g->gr_name, newname))
> return;
>
> g = xmalloc(sizeof(*g));
On 08/01/2011 03:02 PM, Matthew Treinish wrote:
> Upon further inspection of mountd the duplicate check in insert group is not
> needed. It seems that export_read() already filters out duplicates so the
> check for duplicates again in insert groups isn't needed.
I think this check is still needed so for now I'm going to
leave it...
steved.
>
> Signed-off-by: Matthew Treinish <[email protected]>
> ---
> utils/mountd/mountd.c | 5 -----
> 1 files changed, 0 insertions(+), 5 deletions(-)
>
> diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
> index bcf5080..9c27d6c 100644
> --- a/utils/mountd/mountd.c
> +++ b/utils/mountd/mountd.c
> @@ -631,11 +631,6 @@ static exportnode *lookup_or_create_elist_entry(exports *elist, nfs_export *exp)
> static void insert_group(struct exportnode *e, char *newname)
> {
> struct groupnode *g;
> -
> - for (g = e->ex_groups; g; g = g->gr_next)
> - if (!strcmp(g->gr_name, newname))
> - return;
> -
> g = xmalloc(sizeof(*g));
> g->gr_name = xstrdup(newname);
> g->gr_next = e->ex_groups;
Upon further inspection of mountd the duplicate check in insert group is not
needed. It seems that export_read() already filters out duplicates so the
check for duplicates again in insert groups isn't needed.
Signed-off-by: Matthew Treinish <[email protected]>
---
utils/mountd/mountd.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index bcf5080..9c27d6c 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -631,11 +631,6 @@ static exportnode *lookup_or_create_elist_entry(exports *elist, nfs_export *exp)
static void insert_group(struct exportnode *e, char *newname)
{
struct groupnode *g;
-
- for (g = e->ex_groups; g; g = g->gr_next)
- if (!strcmp(g->gr_name, newname))
- return;
-
g = xmalloc(sizeof(*g));
g->gr_name = xstrdup(newname);
g->gr_next = e->ex_groups;
--
1.7.4.4