glibc/glibc-2.3.5-nscd-zeronegtimeout.diff

111 lines
3.9 KiB
Diff
Raw Normal View History

Index: nscd/aicache.c
===================================================================
--- nscd/aicache.c.orig
+++ nscd/aicache.c
@@ -515,9 +515,15 @@ next_nip:
if (fd != -1)
TEMP_FAILURE_RETRY (send (fd, &notfound, 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;
+ dataset = NULL;
+ }
+ 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;
Index: nscd/grpcache.c
===================================================================
--- nscd/grpcache.c.orig
+++ nscd/grpcache.c
@@ -113,10 +113,14 @@ cache_addgr (struct database_dyn *db, in
written = TEMP_FAILURE_RETRY (send (fd, &notfound, 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;
Index: nscd/hstcache.c
===================================================================
--- nscd/hstcache.c.orig
+++ nscd/hstcache.c
@@ -119,10 +119,14 @@ cache_addhst (struct database_dyn *db, i
MSG_NOSIGNAL)) != total)
all_written = false;
- 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;
Index: nscd/initgrcache.c
===================================================================
--- nscd/initgrcache.c.orig
+++ nscd/initgrcache.c
@@ -197,10 +197,14 @@ addinitgroupsX (struct database_dyn *db,
written = TEMP_FAILURE_RETRY (send (fd, &notfound, 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;
Index: nscd/pwdcache.c
===================================================================
--- nscd/pwdcache.c.orig
+++ nscd/pwdcache.c
@@ -120,10 +120,14 @@ cache_addpw (struct database_dyn *db, in
written = TEMP_FAILURE_RETRY (send (fd, &notfound, 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;