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

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