aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2022-01-18 09:11:47 +0800
committerIan Kent <raven@themaw.net>2022-05-06 09:14:32 +0800
commitf00c16fa051afbef4ca27b752d7cc4916011b55f (patch)
treed1e26b710d0bdd23524e346636fab387a7fce086
parent80845bbcbc264f19c6c6a81d680e1f2b1ea6d3cc (diff)
downloadautofs-f00c16fa051afbef4ca27b752d7cc4916011b55f.tar.gz
autofs-5.1.8 - simplify cache_add() a little
If a map entry is being added to an existing hash chain there's an unneccessarily complicted setting of ->next of the last entry. Just initialize the map entry ->next field instead and remove the confusing assignment. Signed-off-by: Ian Kent <raven@themaw.net>
-rw-r--r--CHANGELOG1
-rw-r--r--lib/cache.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4e5e82d0..5b37460f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@
- fix loop under run in cache_get_offset_parent().
- bailout on rpc systemerror.
- fix nfsv4 only mounts should not use rpcbind.
+- simplify cache_add() a little.
19/10/2021 autofs-5.1.8
- add xdr_exports().
diff --git a/lib/cache.c b/lib/cache.c
index 8aed28ea..4f908daf 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -564,6 +564,7 @@ int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, c
me->dev = (dev_t) -1;
me->ino = (ino_t) -1;
me->flags = 0;
+ me->next = NULL;
/*
* We need to add to the end if values exist in order to
@@ -583,7 +584,6 @@ int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, c
existing = next;
}
- me->next = existing->next;
existing->next = me;
}
return CHE_OK;