autofs/autofs-5.1.7-cleanup-cache_delete-a-little.patch
DistroBaker a5adb69dac Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/autofs.git#25aaf0b69441b4e7370a195cbf1c7988d0abef3d
2021-03-26 02:05:45 +00:00

65 lines
1.7 KiB
Diff

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