aboutsummaryrefslogtreecommitdiffstats
path: root/amd/amfs_auto.c
diff options
context:
space:
mode:
Diffstat (limited to 'amd/amfs_auto.c')
-rw-r--r--amd/amfs_auto.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/amd/amfs_auto.c b/amd/amfs_auto.c
index 75a451fd111d..34fdb00f501c 100644
--- a/amd/amfs_auto.c
+++ b/amd/amfs_auto.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,6 +97,8 @@ am_ops amfs_auto_ops =
static int
amfs_auto_mount(am_node *mp, mntfs *mf)
{
+ if (mp->am_parent == NULL)
+ return EINVAL;
/*
* Pseudo-directories are used to provide some structure
* to the automounted directories instead
@@ -115,7 +113,7 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
* Historical - not documented.
*/
if (mf->mf_info[0] == '.' && mf->mf_info[1] == '\0')
- mf->mf_info = strealloc(mf->mf_info, mp->am_parent->am_mnt->mf_info);
+ mf->mf_info = strealloc(mf->mf_info, mp->am_parent->am_al->al_mnt->mf_info);
/*
* Compute prefix:
@@ -131,12 +129,12 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
if (mf->mf_fo->opt_pref) {
/* allow pref:=null to set a real null prefix */
if (STREQ(mf->mf_fo->opt_pref, "null")) {
- mp->am_pref = strdup("");
+ mp->am_pref = xstrdup("");
} else {
/*
* the prefix specified as an option
*/
- mp->am_pref = strdup(mf->mf_fo->opt_pref);
+ mp->am_pref = xstrdup(mf->mf_fo->opt_pref);
}
} else {
/*
@@ -147,7 +145,7 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
char *ppref = mp->am_parent->am_pref;
if (ppref == 0)
ppref = "";
- mp->am_pref = str3cat((char *) 0, ppref, mp->am_name, "/");
+ mp->am_pref = str3cat((char *) NULL, ppref, mp->am_name, "/");
}
#ifdef HAVE_FS_AUTOFS