1 2011-01-15 Ulrich Drepper <drepper@gmail.com>
4 * nscd/hstcache.c (tryagain): Define.
5 (cache_addhst): Return tryagain not notfound for temporary errors.
6 (addhstbyX): Also set h_errno to TRY_AGAIN when memory allocation
9 Index: glibc-2.12-2-gc4ccff1/nscd/hstcache.c
10 ===================================================================
11 --- glibc-2.12-2-gc4ccff1.orig/nscd/hstcache.c
12 +++ glibc-2.12-2-gc4ccff1/nscd/hstcache.c
13 @@ -77,6 +77,20 @@ static const hst_response_header notfoun
17 +/* This is the standard reply in case there are temporary problems. */
18 +static const hst_response_header tryagain =
20 + .version = NSCD_VERSION,
26 + .h_addr_list_cnt = 0,
32 cache_addhst (struct database_dyn *db, int fd, request_header *req,
33 const void *key, struct hostent *hst, uid_t owner,
34 @@ -111,11 +125,15 @@ cache_addhst (struct database_dyn *db, i
37 /* We have no data. This means we send the standard reply for this
39 + case. Possibly this is only temporary. */
40 ssize_t total = sizeof (notfound);
41 + assert (sizeof (notfound) == sizeof (tryagain));
43 + const hst_response_header *resp = (errval == EAGAIN
44 + ? &tryagain : ¬found);
47 - TEMP_FAILURE_RETRY (send (fd, ¬found, total,
48 + TEMP_FAILURE_RETRY (send (fd, resp, total,
49 MSG_NOSIGNAL)) != total)
52 @@ -135,7 +153,7 @@ cache_addhst (struct database_dyn *db, i
53 ? db->negtimeout : ttl);
55 /* This is the reply. */
56 - memcpy (&dataset->resp, ¬found, total);
57 + memcpy (&dataset->resp, resp, total);
59 /* Copy the key data. */
60 memcpy (dataset->strdata, key, req->key_len);
61 @@ -490,6 +508,7 @@ addhstbyX (struct database_dyn *db, int
62 /* We set the error to indicate this is (possibly) a
63 temporary error and that it does not mean the entry
64 is not available at all. */
65 + h_errno = TRY_AGAIN;