summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-06-29 17:58:44 +0000
committeralfred <alfred@FreeBSD.org>2002-06-29 17:58:44 +0000
commitb3a394a74ca4747129f806557217d290251c3f93 (patch)
tree27aa1604b008c4df559cff52ae50bfb4285c2a18
parentce846a9c494e4339e4517f19e44c5d6693c8a636 (diff)
downloadFreeBSD-src-b3a394a74ca4747129f806557217d290251c3f93.zip
FreeBSD-src-b3a394a74ca4747129f806557217d290251c3f93.tar.gz
Fix several style bugs:
close up the continued line after removing the cast made the line. space before parentheses in indirect function call. Add an addtional error handler case for the results of callback. Submitted by: bde
-rw-r--r--sys/kern/vfs_export.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 4df081a..a080c0c 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -153,11 +153,22 @@ vfs_hang_addrlist(mp, nep, argp)
goto out;
}
}
- rn = (*rnh->rnh_addaddr) (saddr, smask, rnh,
- np->netc_rnodes);
- if (rn == 0 || np != (struct netcred *) rn) { /* already exists */
- error = EPERM;
- goto out;
+ rn = (*rnh->rnh_addaddr)(saddr, smask, rnh, np->netc_rnodes);
+ if (rn == 0) {
+ /*
+ * One of the reasons that rnh_addaddr may fail is that
+ * the entry already exists. To check for this case, we
+ * look up the entry to see if it is there. If so, we
+ * do not need to make a new entry but do return success.
+ */
+ free(np, M_NETADDR);
+ rn = (*rnh->rnh_matchaddr)(saddr, rnh);
+ if (rn != 0 && (rn->rn_flags & RNF_ROOT) == 0 &&
+ ((struct netcred *)rn)->netc_exflags == argp->ex_flags &&
+ !bcmp(&((struct netcred *)rn)->netc_anon,
+ &argp->ex_anon, sizeof(struct ucred)))
+ return (0);
+ return (EPERM);
}
np->netc_exflags = argp->ex_flags;
bzero(&np->netc_anon, sizeof(np->netc_anon));
@@ -357,8 +368,7 @@ vfs_export_lookup(mp, nam)
rnh = nep->ne_rtable[saddr->sa_family];
if (rnh != NULL) {
np = (struct netcred *)
- (*rnh->rnh_matchaddr)(saddr,
- rnh);
+ (*rnh->rnh_matchaddr)(saddr, rnh);
if (np && np->netc_rnodes->rn_flags & RNF_ROOT)
np = NULL;
}
OpenPOWER on IntegriCloud