autofs/SOURCES/autofs-5.1.7-rename-path-to-m_offset-in-update_offset_entry.patch
2021-10-08 09:51:03 +00:00

156 lines
4.7 KiB
Diff

autofs-5.1.7 - rename path to m_offset in update_offset_entry()
From: Ian Kent <raven@themaw.net>
Rename local variable from path to m_offset in update_offset_entry() to
make the meaning of this variable clear.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_sun.c | 46 +++++++++++++++++++++++-----------------------
2 files changed, 24 insertions(+), 23 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -24,6 +24,7 @@
- don't add offset mounts to mounted mounts table.
- reduce umount EBUSY check delay.
- cleanup cache_delete() a little.
+- rename path to m_offset in update_offset_entry().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/parse_sun.c
+++ autofs-5.1.4/modules/parse_sun.c
@@ -798,36 +798,36 @@ static int
update_offset_entry(struct autofs_point *ap,
struct mapent_cache *mc, const char *name,
const char *m_root, int m_root_len,
- const char *path, const char *myoptions,
+ const char *m_offset, const char *myoptions,
const char *loc, time_t age)
{
char m_key[PATH_MAX + 1];
char m_mapent[MAPENT_MAX_LEN + 1];
- int p_len, m_key_len, m_options_len, m_mapent_len;
+ int o_len, m_key_len, m_options_len, m_mapent_len;
int ret;
memset(m_mapent, 0, MAPENT_MAX_LEN + 1);
/* Internal hosts map may have loc == NULL */
- if (!*path) {
+ if (!*m_offset) {
error(ap->logopt,
- MODPREFIX "syntax error in offset %s -> %s", path, loc);
+ MODPREFIX "syntax error in offset %s -> %s", m_offset, loc);
return CHE_FAIL;
}
- p_len = strlen(path);
+ o_len = strlen(m_offset);
/* Trailing '/' causes us pain */
- if (p_len > 1) {
- while (p_len > 1 && path[p_len - 1] == '/')
- p_len--;
+ if (o_len > 1) {
+ while (o_len > 1 && m_offset[o_len - 1] == '/')
+ o_len--;
}
- m_key_len = m_root_len + p_len;
+ m_key_len = m_root_len + o_len;
if (m_key_len > PATH_MAX) {
error(ap->logopt, MODPREFIX "multi mount key too long");
return CHE_FAIL;
}
strcpy(m_key, m_root);
- strncat(m_key, path, p_len);
+ strncat(m_key, m_offset, o_len);
m_key[m_key_len] = '\0';
m_options_len = 0;
@@ -862,15 +862,15 @@ update_offset_entry(struct autofs_point
if (ret == CHE_DUPLICATE) {
warn(ap->logopt, MODPREFIX
- "syntax error or duplicate offset %s -> %s", path, loc);
+ "syntax error or duplicate offset %s -> %s", m_offset, loc);
ret = CHE_OK;
} else if (ret == CHE_FAIL)
debug(ap->logopt, MODPREFIX
- "failed to update multi-mount offset %s -> %s", path, m_mapent);
+ "failed to update multi-mount offset %s -> %s", m_offset, m_mapent);
else {
ret = CHE_OK;
debug(ap->logopt, MODPREFIX
- "updated multi-mount offset %s -> %s", path, m_mapent);
+ "updated multi-mount offset %s -> %s", m_offset, m_mapent);
}
return ret;
@@ -1540,22 +1540,22 @@ dont_expand:
/* It's a multi-mount; deal with it */
do {
- char *path, *myoptions, *loc;
+ char *m_offset, *myoptions, *loc;
int status;
if ((*p == '"' && *(p + 1) != '/') || (*p != '"' && *p != '/')) {
l = 0;
- path = dequote("/", 1, ap->logopt);
+ m_offset = dequote("/", 1, ap->logopt);
debug(ap->logopt,
- MODPREFIX "dequote(\"/\") -> %s", path);
+ MODPREFIX "dequote(\"/\") -> %s", m_offset);
} else {
l = span_space(p, mapent_len - (p - pmapent));
- path = sanitize_path(p, l, LKP_MULTI, ap->logopt);
+ m_offset = sanitize_path(p, l, LKP_MULTI, ap->logopt);
debug(ap->logopt, MODPREFIX
- "dequote(\"%.*s\") -> %s", l, p, path);
+ "dequote(\"%.*s\") -> %s", l, p, m_offset);
}
- if (!path) {
+ if (!m_offset) {
warn(ap->logopt, MODPREFIX "null path or out of memory");
cache_writelock(mc);
cache_delete_offset_list(mc, name);
@@ -1577,7 +1577,7 @@ dont_expand:
cache_writelock(mc);
cache_delete_offset_list(mc, name);
cache_unlock(mc);
- free(path);
+ free(m_offset);
free(options);
free(pmapent);
pthread_setcancelstate(cur_state, NULL);
@@ -1589,14 +1589,14 @@ dont_expand:
status = update_offset_entry(ap, mc,
name, m_root, m_root_len,
- path, myoptions, loc, age);
+ m_offset, myoptions, loc, age);
if (status != CHE_OK) {
warn(ap->logopt, MODPREFIX "error adding multi-mount");
cache_writelock(mc);
cache_delete_offset_list(mc, name);
cache_unlock(mc);
- free(path);
+ free(m_offset);
free(options);
free(pmapent);
free(myoptions);
@@ -1608,7 +1608,7 @@ dont_expand:
if (loc)
free(loc);
- free(path);
+ free(m_offset);
free(myoptions);
} while (*p == '/' || (*p == '"' && *(p + 1) == '/'));