diff options
Diffstat (limited to 'libc/nscd/grpcache.c')
-rw-r--r-- | libc/nscd/grpcache.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libc/nscd/grpcache.c b/libc/nscd/grpcache.c index fa2192901..8a2f80ccd 100644 --- a/libc/nscd/grpcache.c +++ b/libc/nscd/grpcache.c @@ -114,13 +114,18 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, case. */ total = sizeof (notfound); - written = TEMP_FAILURE_RETRY (send (fd, ¬found, total, - MSG_NOSIGNAL)); + if (fd != -1) + written = TEMP_FAILURE_RETRY (send (fd, ¬found, 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 (db->negtimeout == 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; |