summary refs log tree commit diff
path: root/nscd/cache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-14 15:26:10 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-14 15:26:10 +0000
commitf9e2261b7e0591909df321e2890b26d900a326d8 (patch)
treed417ea5791b72220ffb53fe2a1bae1df5afdf9d4 /nscd/cache.c
parent43850227c932267142beef13fae7ced839b006ad (diff)
downloadglibc-f9e2261b7e0591909df321e2890b26d900a326d8.tar.gz
glibc-f9e2261b7e0591909df321e2890b26d900a326d8.tar.xz
glibc-f9e2261b7e0591909df321e2890b26d900a326d8.zip
* nscd/cache.c (prune_cache): If cache is empty, instruct caller
	to wake up in 24 hours.
Diffstat (limited to 'nscd/cache.c')
-rw-r--r--nscd/cache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nscd/cache.c b/nscd/cache.c
index ea79c38548..4d812e2422 100644
--- a/nscd/cache.c
+++ b/nscd/cache.c
@@ -288,7 +288,8 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
     dbg_log (_("pruning %s cache; time %ld"),
 	     dbnames[table - dbs], (long int) now);
 
-  time_t next_timeout = LONG_MAX;
+#define NO_TIMEOUT LONG_MAX
+  time_t next_timeout = NO_TIMEOUT;
   do
     {
       ref_t run = table->head->array[--cnt];
@@ -474,5 +475,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
   if (any)
     gc (table);
 
-  return next_timeout - now;
+  /* If there is no entry in the database and we therefore have no new
+     timeout value, tell the caller to wake up in 24 hours.  */
+  return next_timeout == NO_TIMEOUT ? 24 * 60 * 60 : next_timeout - now;
 }