Blame SOURCES/autofs-5.1.7-remove-redundant-local-var-from-sun_mount.patch

96dc52
autofs-5.1.7 - remove redundant local var from sun_mount()
96dc52
96dc52
From: Ian Kent <raven@themaw.net>
96dc52
96dc52
The local variable mountpoint in sun_mount() is set directly from a
96dc52
passed in parameter and never changed and the source isn't changed
96dc52
either, so use the variable directly.
96dc52
96dc52
Signed-off-by: Ian Kent <raven@themaw.net>
96dc52
---
96dc52
 CHANGELOG           |    1 +
96dc52
 modules/parse_sun.c |   13 ++++---------
96dc52
 2 files changed, 5 insertions(+), 9 deletions(-)
96dc52
96dc52
diff --git a/CHANGELOG b/CHANGELOG
96dc52
index 76fccf70..444ade5b 100644
96dc52
--- a/CHANGELOG
96dc52
+++ b/CHANGELOG
96dc52
@@ -42,6 +42,7 @@
96dc52
 - add mount and umount offsets functions.
96dc52
 - switch to use tree implementation for offsets.
96dc52
 - remove obsolete functions.
96dc52
+- remove redundant local var from sun_mount().
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 ef74eda9..437869b5 100644
96dc52
--- a/modules/parse_sun.c
96dc52
+++ b/modules/parse_sun.c
96dc52
@@ -530,7 +530,6 @@ static int sun_mount(struct autofs_point *ap, const char *root,
96dc52
 	int nonstrict = 1;
96dc52
 	int use_weight_only = ap->flags & MOUNT_FLAG_USE_WEIGHT_ONLY;
96dc52
 	int rv, cur_state;
96dc52
-	char *mountpoint;
96dc52
 	char *what;
96dc52
 	char *type;
96dc52
 
96dc52
@@ -624,9 +623,6 @@ static int sun_mount(struct autofs_point *ap, const char *root,
96dc52
 		}
96dc52
 	}
96dc52
 
96dc52
-	mountpoint = alloca(namelen + 1);
96dc52
-	sprintf(mountpoint, "%.*s", namelen, name);
96dc52
-
96dc52
 	type = ap->entry->maps->type;
96dc52
 	if (type && !strcmp(type, "hosts")) {
96dc52
 		if (options && *options != '\0') {
96dc52
@@ -698,9 +694,9 @@ static int sun_mount(struct autofs_point *ap, const char *root,
96dc52
 		debug(ap->logopt, MODPREFIX
96dc52
 		      "mounting root %s, mountpoint %s, "
96dc52
 		      "what %s, fstype %s, options %s",
96dc52
-		      root, mountpoint, what, fstype, options);
96dc52
+		      root, name, what, fstype, options);
96dc52
 
96dc52
-		rv = mount_nfs->mount_mount(ap, root, mountpoint, strlen(mountpoint),
96dc52
+		rv = mount_nfs->mount_mount(ap, root, name, namelen,
96dc52
 					    what, fstype, options, mount_nfs->context);
96dc52
 	} else {
96dc52
 		if (!loclen)
96dc52
@@ -720,11 +716,10 @@ static int sun_mount(struct autofs_point *ap, const char *root,
96dc52
 		debug(ap->logopt, MODPREFIX
96dc52
 		      "mounting root %s, mountpoint %s, "
96dc52
 		      "what %s, fstype %s, options %s",
96dc52
-		      root, mountpoint, what, fstype, options);
96dc52
+		      root, name, what, fstype, options);
96dc52
 
96dc52
 		/* Generic mount routine */
96dc52
-		rv = do_mount(ap, root, mountpoint, strlen(mountpoint), what, fstype,
96dc52
-			      options);
96dc52
+		rv = do_mount(ap, root, name, namelen, what, fstype, options);
96dc52
 	}
96dc52
 	pthread_setcancelstate(cur_state, NULL);
96dc52