Send to libc-alpha on 2011-07-01, will be part of glibc 2.15. commit id: 445b4a53ea9d6c457c5f4ac1538102d8be0a5d89 2011-07-01 Thorsten Kukuk * nscd/pwdcache.c (cache_addpw): Handle zero negtimeout. * nscd/initgrcache.c (addinitgroupsX): Likewise. * nscd/hstcache.c (cache_addhst): Likewise. * nscd/grpcache.c (cache_addgr): Likewise. * nscd/aicache.c (addhstaiX): Likewise. Index: nscd/aicache.c =================================================================== --- nscd/aicache.c.orig +++ nscd/aicache.c @@ -504,9 +504,15 @@ next_nip: if (fd != -1) 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; + 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, ¬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; 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, ¬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; 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, ¬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;