about summary refs log tree commit diff
path: root/nscd/servicescache.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/servicescache.c')
-rw-r--r--nscd/servicescache.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/nscd/servicescache.c b/nscd/servicescache.c
index b0a2977935..ec5a367db8 100644
--- a/nscd/servicescache.c
+++ b/nscd/servicescache.c
@@ -108,10 +108,15 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
 						MSG_NOSIGNAL));
 
-	  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 (__builtin_expect (db->negtimeout == 0, 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;