about summary refs log tree commit diff
path: root/nscd/hstcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/hstcache.c')
-rw-r--r--nscd/hstcache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 1ab5860f2d..1f09c0b975 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -141,10 +141,14 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
 					MSG_NOSIGNAL)) != total)
 	    all_written = false;
 
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
-				   1);
 	  /* If we cannot permanently store the result, so be it.  */
-	  if (dataset != NULL)
+	  if (db->negtimeout == 0)
+	    {
+	      /* Mark the old entry as obsolete.  */
+	      if (dh != NULL)
+		dh->usable = false;
+	    }
+	  else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
 	    {
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
 	      dataset->head.recsize = total;