+2005-10-06 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * include/am_compat.h (INADDR_NONE): define in a common location,
+ if OS doesn't have it, use 0xffffffffU which should work with any
+ ANSI compiler.
+
+ * fixmount/fixmount.c, libamu/wire.c: remove local definition of
+ INADDR_NONE.
+
+ * amd/amfs_toplvl.c (amfs_toplvl_mount), amd/amfs_auto.c
+ (amfs_auto_mount): use common SIZEOF_OPTS in definition and call
+ to autofs_get_opts.
+
+ * amd/amd.h (SIZEOF_OPTS): moved #define to common header.
+
+2005-10-06 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * amd/opts.c (expand_op): Need to check BUFSPACE for env for
+ vlen+1. Likewise for cp and strlen(cp)+1.
+
+ * amd/amfs_toplvl.c (amfs_toplvl_mount) [HAVE_FS_AUTOFS]: Pass new
+ size argument to autofs_get_opts.
+
2005-10-05 Erez Zadok <ezk@cs.sunysb.edu>
* amq/pawd.c (transform_dir): use TCP first, else UDP. Destroy
extern char pid_fsname[SIZEOF_PID_FSNAME]; /* "kiska.southseas.nz:(pid%d)" */
#define SIZEOF_HOSTD (2 * MAXHOSTNAMELEN + 1)
extern char hostd[SIZEOF_HOSTD]; /* Host+domain */
+#define SIZEOF_OPTS 256 /* used for char opts[] and preopts[] */
/*
* Global variables.
#ifdef HAVE_FS_AUTOFS
if (mf->mf_flags & MFF_IS_AUTOFS) {
- char opts[256];
+ char opts[SIZEOF_OPTS];
int error;
- autofs_get_opts(opts, sizeof(opts), mp->am_autofs_fh);
+ autofs_get_opts(opts, SIZEOF_OPTS, mp->am_autofs_fh);
/* now do the mount */
error = amfs_mount(mp, mf, opts);
amfs_toplvl_mount(am_node *mp, mntfs *mf)
{
struct stat stb;
-#define SIZEOF_OPTS 256
char opts[SIZEOF_OPTS], preopts[SIZEOF_OPTS];
int error;
#ifdef HAVE_FS_AUTOFS
if (mf->mf_flags & MFF_IS_AUTOFS) {
- autofs_get_opts(opts, mp->am_autofs_fh);
+ autofs_get_opts(opts, SIZEOF_OPTS, mp->am_autofs_fh);
} else
#endif /* HAVE_FS_AUTOFS */
{
if (env) {
int vlen = strlen(env);
- if (BUFSPACE(ep, vlen)) {
- xstrlcpy(ep, env, vlen);
+ if (BUFSPACE(ep, vlen+1)) {
+ xstrlcpy(ep, env, vlen+1);
ep += vlen;
} else {
plog(XLOG_ERROR, EXPAND_ERROR, opt);
/*
* Finish off the expansion
*/
- if (BUFSPACE(ep, strlen(cp))) {
- xstrlcpy(ep, cp, strlen(cp));
- /* ep += strlen(ep); */
+ int vlen = strlen(cp);
+ if (BUFSPACE(ep, vlen+1)) {
+ xstrlcpy(ep, cp, vlen+1);
+ /* ep += vlen; */
} else {
plog(XLOG_ERROR, EXPAND_ERROR, opt);
}
#define CREATE_TIMEOUT 2 /* seconds */
#define CALL_TIMEOUT 5 /* seconds */
-#ifndef INADDR_NONE
-# define INADDR_NONE 0xffffffff
-#endif /* not INADDR_NONE */
-
/* Constant defs */
#define ALL 1
#define DIRS 2
};
#endif /* not HAVE_NETCONFIG_H and not HAVE_SYS_NETCONFIG_H */
+/* some OSs don't define INADDR_NONE and assume it's unsigned -1 */
+#ifndef INADDR_NONE
+# define INADDR_NONE 0xffffffffU
+#endif /* INADDR_NONE */
+
#endif /* not _AM_COMPAT_H */
};
static addrlist *localnets = NULL;
-#ifndef INADDR_NONE
-# define INADDR_NONE ((unsigned long) -1)
-#endif /* INADDR_NONE */
-
#if defined(IFF_LOCAL_LOOPBACK) && !defined(IFF_LOOPBACK)
# define IFF_LOOPBACK IFF_LOCAL_LOOPBACK
#endif /* defined(IFF_LOCAL_LOOPBACK) && !defined(IFF_LOOPBACK) */