diff --git a/agent/ChangeLog b/agent/ChangeLog index d835c8e60..fa450dfdb 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,8 @@ +2005-01-04 Werner Koch + + * cache.c (agent_put_cache): Fix the test for using the default + TTL. + 2004-12-21 Werner Koch * preset-passphrase.c (preset_passphrase): Handle --passphrase. diff --git a/agent/cache.c b/agent/cache.c index b6762edd0..18aa7653b 100644 --- a/agent/cache.c +++ b/agent/cache.c @@ -39,7 +39,7 @@ struct cache_item_s { ITEM next; time_t created; time_t accessed; - int ttl; /* max. lifetime given in seonds, -1 one means infinite */ + int ttl; /* max. lifetime given in seconds, -1 one means infinite */ int lockcount; struct secret_data_s *pw; char key[1]; @@ -185,17 +185,18 @@ agent_flush_cache (void) /* Store DATA of length DATALEN in the cache under KEY and mark it with a maximum lifetime of TTL seconds. If there is already data under this key, it will be replaced. Using a DATA of NULL deletes - the entry */ + the entry. A TTL of 0 is replaced by the default TTL and a TTL of + -1 set infinite timeout. */ int agent_put_cache (const char *key, const char *data, int ttl) { ITEM r; if (DBG_CACHE) - log_debug ("agent_put_cache `%s'\n", key); + log_debug ("agent_put_cache `%s' requested ttl=%d\n", key, ttl); housekeeping (); - if (ttl == 1) + if (!ttl) ttl = opt.def_cache_ttl; if (!ttl) return 0;