2005-10-06 Erez Zadok <ezk@cs.sunysb.edu>
+ * conf/autofs/autofs_solaris_v2_v3.c (autofs_lookup_2_req)
+ conf/autofs/autofs_solaris_v1.c (autofs_mount_1_req), amd/opts.c,
+ amd/nfs_subr.c (nfsproc_lookup_2_svc), amd/nfs_start.c
+ (mount_automounter), amd/get_args.c (get_args), amd/amfs_toplvl.c,
+ amd/amfs_auto.c (amfs_auto_mount), amd/amd.h, amd/amd.c (main):
+ use sizeof() instead of fixed SIZEOF_* macros.
+
* libamu/strutil.c (xstrlcat, xstrlcpy), include/am_utils.h
(DEBUG): if debugging is on, then also print the source file name
and line number that called xstrl* with a buffer that wasn't large
*domdot++ = '\0';
hostdomain = domdot;
}
- xstrlcpy(hostd, hostname, SIZEOF_HOSTD);
+ xstrlcpy(hostd, hostname, sizeof(hostd));
am_set_hostname(hostname);
/*
extern char *conf_tag;
#define SIZEOF_UID_STR 12
#define SIZEOF_GID_STR 12
-extern char *opt_gid;
-extern char *opt_uid;
+extern char *opt_gid, gid_str[SIZEOF_GID_STR];
+extern char *opt_uid, uid_str[SIZEOF_UID_STR];
extern int NumChildren;
extern int fwd_sock;
extern int select_intr_valid;
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);
#ifdef HAVE_FS_AUTOFS
if (mf->mf_flags & MFF_IS_AUTOFS) {
- autofs_get_opts(opts, SIZEOF_OPTS, mp->am_autofs_fh);
+ autofs_get_opts(opts, sizeof(opts), mp->am_autofs_fh);
} else
#endif /* HAVE_FS_AUTOFS */
{
preopts[0] = '\0';
#ifdef MNTTAB_OPT_INTR
- xstrlcat(preopts, MNTTAB_OPT_INTR, SIZEOF_OPTS);
- xstrlcat(preopts, ",", SIZEOF_OPTS);
+ xstrlcat(preopts, MNTTAB_OPT_INTR, sizeof(preopts));
+ xstrlcat(preopts, ",", sizeof(preopts));
#endif /* MNTTAB_OPT_INTR */
#ifdef MNTTAB_OPT_IGNORE
- xstrlcat(preopts, MNTTAB_OPT_IGNORE, SIZEOF_OPTS);
- xstrlcat(preopts, ",", SIZEOF_OPTS);
+ xstrlcat(preopts, MNTTAB_OPT_IGNORE, sizeof(preopts));
+ xstrlcat(preopts, ",", sizeof(preopts));
#endif /* MNTTAB_OPT_IGNORE */
#ifdef WANT_TIMEO_AND_RETRANS_ON_TOPLVL
- xsnprintf(opts, SIZEOF_OPTS, "%s%s,%s=%d,%s=%d,%s=%d,%s,map=%s",
+ xsnprintf(opts, sizeof(opts), "%s%s,%s=%d,%s=%d,%s=%d,%s,map=%s",
#else /* WANT_TIMEO_AND_RETRANS_ON_TOPLVL */
- xsnprintf(opts, SIZEOF_OPTS, "%s%s,%s=%d,%s,map=%s",
+ xsnprintf(opts, sizeof(opts), "%s%s,%s=%d,%s,map=%s",
#endif /* WANT_TIMEO_AND_RETRANS_ON_TOPLVL */
preopts,
MNTTAB_OPT_RW,
mf->mf_ops->fs_type, mf->mf_info);
#ifdef MNTTAB_OPT_NOAC
if (gopt.auto_attrcache == 0) {
- xstrlcat(opts, ",", SIZEOF_OPTS);
- xstrlcat(opts, MNTTAB_OPT_NOAC, SIZEOF_OPTS);
+ xstrlcat(opts, ",", sizeof(opts));
+ xstrlcat(opts, MNTTAB_OPT_NOAC, sizeof(opts));
} else
#endif /* MNTTAB_OPT_NOAC */
- set_auto_attrcache_timeout(preopts, opts, SIZEOF_OPTS);
+ set_auto_attrcache_timeout(preopts, opts, sizeof(preopts));
}
/* now do the mount */
hostdomain = gopt.sub_domain;
if (*hostdomain == '.')
hostdomain++;
- xstrlcat(hostd, ".", SIZEOF_HOSTD);
- xstrlcat(hostd, hostdomain, SIZEOF_HOSTD);
+ xstrlcat(hostd, ".", sizeof(hostd));
+ xstrlcat(hostd, hostdomain, sizeof(hostd));
#ifdef MOUNT_TABLE_ON_FILE
if (amuDebug(D_MTAB))
if (ret != 0)
return ret;
}
- xsnprintf(pid_fsname, SIZEOF_PID_FSNAME, "%s:(pid%ld,port%u)",
+ xsnprintf(pid_fsname, sizeof(pid_fsname), "%s:(pid%ld,port%u)",
am_get_hostname(), (long) am_mypid, nfs_port);
/* security: if user sets -D noamq, don't even create listening socket */
/* finally, find the effective uid/gid from RPC request */
if (getcreds(rqstp, &uid, &gid, nfsxprt) < 0)
plog(XLOG_ERROR, "cannot get uid/gid from RPC credentials");
- xsnprintf(opt_uid, SIZEOF_UID_STR, "%d", (int) uid);
- xsnprintf(opt_gid, SIZEOF_GID_STR, "%d", (int) gid);
+ xsnprintf(opt_uid, sizeof(uid_str), "%d", (int) uid);
+ xsnprintf(opt_gid, sizeof(gid_str), "%d", (int) gid);
mp = fh_to_mp3(&argp->da_fhandle, &retry, VLOOK_CREATE);
if (mp == NULL) {
static char *opt_keyd = nullstr;
static char *opt_map = nullstr;
static char *opt_path = nullstr;
-static char uid_str[SIZEOF_UID_STR], gid_str[SIZEOF_GID_STR];
+char uid_str[SIZEOF_UID_STR], gid_str[SIZEOF_GID_STR];
char *opt_uid = uid_str;
char *opt_gid = gid_str;
static char *vars[8];
m->name, m->map, m->opts, m->path);
/* find the effective uid/gid from RPC request */
- xsnprintf(opt_uid, SIZEOF_UID_STR, "%d", (int) cred->aup_uid);
- xsnprintf(opt_gid, SIZEOF_GID_STR, "%d", (int) cred->aup_gid);
+ xsnprintf(opt_uid, sizeof(uid_str), "%d", (int) cred->aup_uid);
+ xsnprintf(opt_gid, sizeof(gid_str), "%d", (int) cred->aup_gid);
mp = find_ap(m->path);
if (!mp) {
m->path, m->isdirect);
/* find the effective uid/gid from RPC request */
- xsnprintf(opt_uid, SIZEOF_UID_STR, "%d", (int) cred->aup_uid);
- xsnprintf(opt_gid, SIZEOF_GID_STR, "%d", (int) cred->aup_gid);
+ xsnprintf(opt_uid, sizeof(uid_str), "%d", (int) cred->aup_uid);
+ xsnprintf(opt_gid, sizeof(gid_str), "%d", (int) cred->aup_gid);
mp = find_ap(m->path);
if (!mp) {
m->path, m->isdirect);
/* find the effective uid/gid from RPC request */
- xsnprintf(opt_uid, SIZEOF_UID_STR, "%d", (int) cred->aup_uid);
- xsnprintf(opt_gid, SIZEOF_GID_STR, "%d", (int) cred->aup_gid);
+ xsnprintf(opt_uid, sizeof(uid_str), "%d", (int) cred->aup_uid);
+ xsnprintf(opt_gid, sizeof(gid_str), "%d", (int) cred->aup_gid);
mp = find_ap(m->path);
if (!mp) {