diff options
Diffstat (limited to 'nscd/grpcache.c')
-rw-r--r-- | nscd/grpcache.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/nscd/grpcache.c b/nscd/grpcache.c index dbc406fcbd..9921ae313e 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -146,10 +146,8 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, /* Now get the lock to safely insert the records. */ pthread_rwlock_rdlock (&db->lock); - if (cache_add (req->type, &dataset->strdata, req->key_len, - &dataset->head, true, db, owner) < 0) - /* Ensure the data can be recovered. */ - dataset->head.usable = false; + (void) cache_add (req->type, &dataset->strdata, req->key_len, + &dataset->head, true, db, owner); pthread_rwlock_unlock (&db->lock); @@ -356,12 +354,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, { if (cache_add (GETGRBYGID, cp, key_offset, &dataset->head, true, db, owner) < 0) - { - /* Could not allocate memory. Make sure the data gets - discarded. */ - dataset->head.usable = false; - goto out; - } + goto out; first = false; } @@ -370,12 +363,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, { if (cache_add (GETGRBYNAME, key_copy, key_len + 1, &dataset->head, true, db, owner) < 0) - { - /* Could not allocate memory. Make sure the data gets - discarded. */ - dataset->head.usable = false; - goto out; - } + goto out; first = false; } @@ -389,12 +377,8 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, { if (req->type == GETGRBYNAME && db->propagate) (void) cache_add (GETGRBYGID, cp, key_offset, &dataset->head, - req->type != GETGRBYNAME, db, owner); + false, db, owner); } - else if (first) - /* Could not allocate memory. Make sure the data gets - discarded. */ - dataset->head.usable = false; out: pthread_rwlock_unlock (&db->lock); |