Blame SOURCES/autofs-5.1.7-rename-path-to-m_offset-in-update_offset_entry.patch

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