summaryrefslogtreecommitdiff
path: root/nscd/connections.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-30 17:32:08 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-30 17:32:08 +0000
commit902c429174f9660eaeb255695f8f335afbfdc54a (patch)
tree2cd188cbcdfd3b82be6aa3187b7755c12b607654 /nscd/connections.c
parentecc685684824cdbb971438ed944794d4bff4547d (diff)
* nscd/nscd.h (prune_cache): Add fd argument to prototype.cvs/fedora-glibc-20060531T1322
* nscd/nscd.c (parse_opt): Read response from INVALIDATE request to make sure the database has been already invalidated. * nscd/cache.c (prune_cache): Add fd argument. Write response to fd after the cache has been invalidated. Use pthread_mutex_lock rather than pthread_mutex_trylock if fd != -1. * nscd/connections.c (invalidate_cache): Add fd argument, write response to fd if not calling prune_cache, pass fd to prune_cache. (handle_request): Adjust invalidate_cache caller. (nscd_run): Pass -1 as fd to prune_cache.
Diffstat (limited to 'nscd/connections.c')
-rw-r--r--nscd/connections.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index da837b5e8a..c4269ce548 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -816,9 +816,10 @@ close_sockets (void)
static void
-invalidate_cache (char *key)
+invalidate_cache (char *key, int fd)
{
dbtype number;
+ int32_t resp;
if (strcmp (key, "passwd") == 0)
number = pwddb;
@@ -832,10 +833,19 @@ invalidate_cache (char *key)
res_init ();
}
else
- return;
+ {
+ resp = EINVAL;
+ writeall (fd, &resp, sizeof (resp));
+ return;
+ }
if (dbs[number].enabled)
- prune_cache (&dbs[number], LONG_MAX);
+ prune_cache (&dbs[number], LONG_MAX, fd);
+ else
+ {
+ resp = 0;
+ writeall (fd, &resp, sizeof (resp));
+ }
}
@@ -1092,7 +1102,7 @@ cannot handle old request version %d; current version is %d"),
else if (uid == 0)
{
if (req->type == INVALIDATE)
- invalidate_cache (key);
+ invalidate_cache (key, fd);
else
termination_handler (0);
}
@@ -1438,7 +1448,7 @@ handle_request: request received (Version = %d)"), req.version);
/* The pthread_cond_timedwait() call timed out. It is time
to clean up the cache. */
assert (my_number < lastdb);
- prune_cache (&dbs[my_number], time (NULL));
+ prune_cache (&dbs[my_number], time (NULL), -1);
if (clock_gettime (timeout_clock, &prune_ts) == -1)
/* Should never happen. */