autofs-5.1.9 - don't open code negative update in lookup

From: Ian Kent <raven@themaw.net>

The negative cache timeout is updated in the top level lookup code and
uses identical code to the function cache_update_negative().

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG       |    1 +
 daemon/lookup.c |   14 +-------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 57ff94633..1bd8754bb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -100,6 +100,7 @@
 - remove directory cleanup umount_multi().
 - always set ap for mnt_list entries.
 - improve handling of missing map entry for expire request.
+- don't open code negative update in lookup.
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 3791aa755..6678c7720 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -1147,20 +1147,8 @@ static void update_negative_cache(struct autofs_point *ap, struct map_source *so
 		else
 			map = lookup_get_map_source(entry);
 		if (map) {
-			time_t now = monotonic_time(NULL);
-			int rv = CHE_FAIL;
-
 			cache_writelock(map->mc);
-			me = cache_lookup_distinct(map->mc, name);
-			if (me)
-				rv = cache_push_mapent(me, NULL);
-			else
-				rv = cache_update(map->mc, map, name, NULL, now);
-			if (rv != CHE_FAIL) {
-				me = cache_lookup_distinct(map->mc, name);
-				if (me)
-					me->status = now + ap->negative_timeout;
-			}
+			cache_update_negative(map->mc, map, name, ap->negative_timeout);
 			cache_unlock(map->mc);
 		}
 	}
