Blame SOURCES/autofs-5.1.7-cleanup-cache_delete-a-little.patch

49b67f
autofs-5.1.7 - cleanup cache_delete() a little
49b67f
49b67f
From: Ian Kent <raven@themaw.net>
49b67f
49b67f
There's no reason to use local function storage for the passed in key
49b67f
just use the given key.
49b67f
49b67f
Also, if there's no hash array entry for the key then there's no cache
49b67f
entry so don't return a fail for this case.
49b67f
49b67f
Signed-off-by: Ian Kent <raven@themaw.net>
49b67f
---
49b67f
 CHANGELOG   |    1 +
49b67f
 lib/cache.c |   11 +++--------
49b67f
 2 files changed, 4 insertions(+), 8 deletions(-)
49b67f
49b67f
--- autofs-5.1.4.orig/CHANGELOG
49b67f
+++ autofs-5.1.4/CHANGELOG
49b67f
@@ -23,6 +23,7 @@
49b67f
 - eliminate some strlen calls in offset handling.
49b67f
 - don't add offset mounts to mounted mounts table.
49b67f
 - reduce umount EBUSY check delay.
49b67f
+- cleanup cache_delete() a little.
49b67f
 
49b67f
 xx/xx/2018 autofs-5.1.5
49b67f
 - fix flag file permission.
49b67f
--- autofs-5.1.4.orig/lib/cache.c
49b67f
+++ autofs-5.1.4/lib/cache.c
49b67f
@@ -887,20 +887,15 @@ int cache_delete(struct mapent_cache *mc
49b67f
 	struct mapent *me = NULL, *pred;
49b67f
 	u_int32_t hashval = hash(key, mc->size);
49b67f
 	int ret = CHE_OK;
49b67f
-	char this[PATH_MAX];
49b67f
-
49b67f
-	strcpy(this, key);
49b67f
 
49b67f
 	me = mc->hash[hashval];
49b67f
-	if (!me) {
49b67f
-		ret = CHE_FAIL;
49b67f
+	if (!me)
49b67f
 		goto done;
49b67f
-	}
49b67f
 
49b67f
 	while (me->next != NULL) {
49b67f
 		pred = me;
49b67f
 		me = me->next;
49b67f
-		if (strcmp(this, me->key) == 0) {
49b67f
+		if (strcmp(key, me->key) == 0) {
49b67f
 			struct stack *s = me->stack;
49b67f
 			if (me->multi && !list_empty(&me->multi_list)) {
49b67f
 				ret = CHE_FAIL;
49b67f
@@ -929,7 +924,7 @@ int cache_delete(struct mapent_cache *mc
49b67f
 	if (!me)
49b67f
 		goto done;
49b67f
 
49b67f
-	if (strcmp(this, me->key) == 0) {
49b67f
+	if (strcmp(key, me->key) == 0) {
49b67f
 		struct stack *s = me->stack;
49b67f
 		if (me->multi && !list_empty(&me->multi_list)) {
49b67f
 			ret = CHE_FAIL;