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

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