diff options
author | Ian Kent <raven@themaw.net> | 2021-03-03 09:48:33 +0800 |
---|---|---|
committer | Ian Kent <raven@themaw.net> | 2021-03-15 09:52:45 +0800 |
commit | 5f0dfff3ac51ad0fac2efeba8c4e870828b0b158 (patch) | |
tree | 9e5f6e1bea53ffe499e42c30d23329ae3514bd46 /modules | |
parent | a5fa6a8d7b0db7643acd5e8702a8dedd85dedd8f (diff) | |
download | autofs-5f0dfff3ac51ad0fac2efeba8c4e870828b0b158.tar.gz |
autofs-5.1.7 - add a len field to struct autofs_point
Add a path length field to struct autofs_point since the path length
is needed at various times avoiding additional strlen() calls.
Signed-off-by: Ian Kent <raven@themaw.net>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/parse_amd.c | 4 | ||||
-rw-r--r-- | modules/parse_sun.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/parse_amd.c b/modules/parse_amd.c index d3e8a450..5a9079d6 100644 --- a/modules/parse_amd.c +++ b/modules/parse_amd.c @@ -147,7 +147,7 @@ static struct substvar *add_lookup_vars(struct autofs_point *ap, struct mapent *me; int len; - len = strlen(ap->path) + 1 + key_len + 1; + len = ap->len + 1 + key_len + 1; if (len > PATH_MAX) { error(ap->logopt, MODPREFIX "error: lookup key is greater than PATH_MAX"); @@ -1319,7 +1319,7 @@ static int do_host_mount(struct autofs_point *ap, const char *name, char *target; size_t len; - len = strlen(ap->path) + strlen(entry->rhost) + 2; + len = ap->len + strlen(entry->rhost) + 2; target = malloc(len); if (!target) { warn(ap->logopt, MODPREFIX diff --git a/modules/parse_sun.c b/modules/parse_sun.c index b11c6693..b1f64ca0 100644 --- a/modules/parse_sun.c +++ b/modules/parse_sun.c @@ -1154,7 +1154,7 @@ static int mount_subtree(struct autofs_point *ap, struct mapent_cache *mc, mm_root = mm_key; start = strlen(mm_key); } else { - start = strlen(ap->path) + strlen(mm_key) + 1; + start = ap->len + strlen(mm_key) + 1; mm_root = alloca(start + 3); strcpy(mm_root, ap->path); strcat(mm_root, "/"); @@ -1477,7 +1477,7 @@ dont_expand: } strcpy(m_root, name); } else { - m_root_len = strlen(ap->path) + name_len + 1; + m_root_len = ap->len + name_len + 1; m_root = alloca(m_root_len + 1); if (!m_root) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); |