diff options
author | Werner Koch <[email protected]> | 2018-03-06 15:22:42 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2018-03-06 15:22:42 +0000 |
commit | f060cb5c63923d6caec784f65f3bb0aadf52f795 (patch) | |
tree | 01c8cfb212800be36311b66d9899e607168641db /agent/cache.c | |
parent | gpg: Fix regression in last --card-status patch (diff) | |
download | gnupg-f060cb5c63923d6caec784f65f3bb0aadf52f795.tar.gz gnupg-f060cb5c63923d6caec784f65f3bb0aadf52f795.zip |
agent: Also evict cached items via a timer.
* agent/cache.c (agent_cache_housekeeping): New func.
* agent/gpg-agent.c (handle_tick): Call it.
--
This change mitigates the risk of having cached items in a post mortem
dump.
GnuPG-bug-id: 3829
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | agent/cache.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/agent/cache.c b/agent/cache.c index 80d5f8d1e..ed5c97cd2 100644 --- a/agent/cache.c +++ b/agent/cache.c @@ -259,6 +259,26 @@ housekeeping (void) void +agent_cache_housekeeping (void) +{ + int res; + + if (DBG_CACHE) + log_debug ("agent_cache_housekeeping\n"); + + res = npth_mutex_lock (&cache_lock); + if (res) + log_fatal ("failed to acquire cache mutex: %s\n", strerror (res)); + + housekeeping (); + + res = npth_mutex_unlock (&cache_lock); + if (res) + log_fatal ("failed to release cache mutex: %s\n", strerror (res)); +} + + +void agent_flush_cache (void) { ITEM r; |