Blame SOURCES/autofs-5.1.8-simplify-cache_add-a-little.patch

91594d
autofs-5.1.8 - simplify cache_add() a little
91594d
91594d
From: Ian Kent <raven@themaw.net>
91594d
91594d
If a map entry is being added to an existing hash chain there's an
91594d
unneccessarily complicted setting of ->next of the last entry.
91594d
91594d
Just initialize the map entry ->next field instead and remove the
91594d
confusing assignment.
91594d
91594d
Signed-off-by: Ian Kent <raven@themaw.net>
91594d
---
91594d
 CHANGELOG   |    1 +
91594d
 lib/cache.c |    2 +-
91594d
 2 files changed, 2 insertions(+), 1 deletion(-)
91594d
91594d
--- autofs-5.1.7.orig/CHANGELOG
91594d
+++ autofs-5.1.7/CHANGELOG
91594d
@@ -89,6 +89,7 @@
91594d
 - fix nonstrict fail handling of last offset mount.
91594d
 - dont fail on duplicate offset entry tree add.
91594d
 - fix loop under run in cache_get_offset_parent().
91594d
+- simplify cache_add() a little.
91594d
 
91594d
 25/01/2021 autofs-5.1.7
91594d
 - make bind mounts propagation slave by default.
91594d
--- autofs-5.1.7.orig/lib/cache.c
91594d
+++ autofs-5.1.7/lib/cache.c
91594d
@@ -564,6 +564,7 @@ int cache_add(struct mapent_cache *mc, s
91594d
 	me->dev = (dev_t) -1;
91594d
 	me->ino = (ino_t) -1;
91594d
 	me->flags = 0;
91594d
+	me->next = NULL;
91594d
 
91594d
 	/* 
91594d
 	 * We need to add to the end if values exist in order to
91594d
@@ -583,7 +584,6 @@ int cache_add(struct mapent_cache *mc, s
91594d
 
91594d
 			existing = next;
91594d
 		}
91594d
-		me->next = existing->next;
91594d
 		existing->next = me;
91594d
 	}
91594d
 	return CHE_OK;