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