diff options
Diffstat (limited to 'contrib/amd/amd/amfs_nfsl.c')
-rw-r--r-- | contrib/amd/amd/amfs_nfsl.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/contrib/amd/amd/amfs_nfsl.c b/contrib/amd/amd/amfs_nfsl.c index bb48f0efd255..c70a3eeb97c4 100644 --- a/contrib/amd/amd/amfs_nfsl.c +++ b/contrib/amd/amd/amfs_nfsl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2006 Erez Zadok + * Copyright (c) 1997-2014 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990 The Regents of the University of California. @@ -16,11 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -101,7 +97,7 @@ amfs_nfsl_match(am_opts *fo) char *retval; struct stat stb; - if (fo->opt_sublink) + if (fo->opt_sublink && fo->opt_sublink[0]) cp = fo->opt_sublink; else cp = fo->opt_fs; @@ -116,8 +112,9 @@ amfs_nfsl_match(am_opts *fo) * call nfs_ops.fs_match(). * If link value exists (or same host), call amfs_link_ops.fs_match(). */ - if (!STRCEQ(ho, am_get_hostname())) { - plog(XLOG_INFO, "amfs_nfsl: \"%s\" is not local host, using type:=nfs", ho); + if (!STRCEQ(ho, am_get_hostname()) && !STRCEQ(ho, hostd)) { + plog(XLOG_INFO, "amfs_nfsl: \"%s\" is not the local host \"%s\", " + "or \"%s\" using type:=nfs", ho, am_get_hostname(), hostd); retval = nfs_ops.fs_match(fo); } else if (lstat(cp, &stb) < 0) { plog(XLOG_INFO, "amfs_nfsl: \"%s\" does not exist, using type:=nfs", cp); @@ -213,11 +210,16 @@ amfs_nfsl_umounted(mntfs *mf) static fserver * amfs_nfsl_ffserver(mntfs *mf) { - char *cp; - char *ho = mf->mf_fo->opt_rhost; + char *cp, *ho; struct stat stb; - if (mf->mf_fo->opt_sublink) + if (mf->mf_fo == NULL) { + plog(XLOG_ERROR, "%s: NULL mf_fo", __func__); + return NULL; + } + ho = mf->mf_fo->opt_rhost; + + if (mf->mf_fo->opt_sublink && mf->mf_fo->opt_sublink[0]) cp = mf->mf_fo->opt_sublink; else cp = mf->mf_fo->opt_fs; @@ -227,7 +229,8 @@ amfs_nfsl_ffserver(mntfs *mf) * call amfs_link_ops.ffserver(). * If link value exists (or same host), then call ops_nfs.ffserver(). */ - if (!STRCEQ(ho, am_get_hostname()) || lstat(cp, &stb) < 0) { + if ((!STRCEQ(ho, am_get_hostname()) && + !STRCEQ(ho, hostd)) || lstat(cp, &stb) < 0) { return nfs_ops.ffserver(mf); } else { mf->mf_flags |= MFF_NFSLINK; |