|
|
96dc52 |
autofs-5.1.7 - cleanup cache_delete() a little
|
|
|
96dc52 |
|
|
|
96dc52 |
From: Ian Kent <raven@themaw.net>
|
|
|
96dc52 |
|
|
|
96dc52 |
There's no reason to use local function storage for the passed in key
|
|
|
96dc52 |
just use the given key.
|
|
|
96dc52 |
|
|
|
96dc52 |
Also, if there's no hash array entry for the key then there's no cache
|
|
|
96dc52 |
entry so don't return a fail for this case.
|
|
|
96dc52 |
|
|
|
96dc52 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
96dc52 |
---
|
|
|
96dc52 |
CHANGELOG | 1 +
|
|
|
96dc52 |
lib/cache.c | 11 +++--------
|
|
|
96dc52 |
2 files changed, 4 insertions(+), 8 deletions(-)
|
|
|
96dc52 |
|
|
|
96dc52 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
96dc52 |
index 6419052d..e822efec 100644
|
|
|
96dc52 |
--- a/CHANGELOG
|
|
|
96dc52 |
+++ b/CHANGELOG
|
|
|
96dc52 |
@@ -24,6 +24,7 @@
|
|
|
96dc52 |
- eliminate some strlen calls in offset handling.
|
|
|
96dc52 |
- don't add offset mounts to mounted mounts table.
|
|
|
96dc52 |
- reduce umount EBUSY check delay.
|
|
|
96dc52 |
+- cleanup cache_delete() a little.
|
|
|
96dc52 |
|
|
|
96dc52 |
25/01/2021 autofs-5.1.7
|
|
|
96dc52 |
- make bind mounts propagation slave by default.
|
|
|
96dc52 |
diff --git a/lib/cache.c b/lib/cache.c
|
|
|
96dc52 |
index 03d0499a..a90bbb1d 100644
|
|
|
96dc52 |
--- a/lib/cache.c
|
|
|
96dc52 |
+++ b/lib/cache.c
|
|
|
96dc52 |
@@ -917,20 +917,15 @@ int cache_delete(struct mapent_cache *mc, const char *key)
|
|
|
96dc52 |
struct mapent *me = NULL, *pred;
|
|
|
96dc52 |
u_int32_t hashval = hash(key, mc->size);
|
|
|
96dc52 |
int ret = CHE_OK;
|
|
|
96dc52 |
- char this[PATH_MAX];
|
|
|
96dc52 |
-
|
|
|
96dc52 |
- strcpy(this, key);
|
|
|
96dc52 |
|
|
|
96dc52 |
me = mc->hash[hashval];
|
|
|
96dc52 |
- if (!me) {
|
|
|
96dc52 |
- ret = CHE_FAIL;
|
|
|
96dc52 |
+ if (!me)
|
|
|
96dc52 |
goto done;
|
|
|
96dc52 |
- }
|
|
|
96dc52 |
|
|
|
96dc52 |
while (me->next != NULL) {
|
|
|
96dc52 |
pred = me;
|
|
|
96dc52 |
me = me->next;
|
|
|
96dc52 |
- if (strcmp(this, me->key) == 0) {
|
|
|
96dc52 |
+ if (strcmp(key, me->key) == 0) {
|
|
|
96dc52 |
struct stack *s = me->stack;
|
|
|
96dc52 |
if (me->multi && !list_empty(&me->multi_list)) {
|
|
|
96dc52 |
ret = CHE_FAIL;
|
|
|
96dc52 |
@@ -959,7 +954,7 @@ int cache_delete(struct mapent_cache *mc, const char *key)
|
|
|
96dc52 |
if (!me)
|
|
|
96dc52 |
goto done;
|
|
|
96dc52 |
|
|
|
96dc52 |
- if (strcmp(this, me->key) == 0) {
|
|
|
96dc52 |
+ if (strcmp(key, me->key) == 0) {
|
|
|
96dc52 |
struct stack *s = me->stack;
|
|
|
96dc52 |
if (me->multi && !list_empty(&me->multi_list)) {
|
|
|
96dc52 |
ret = CHE_FAIL;
|