]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/glibc/glibc-rh703480.patch
Merge remote-tracking branch 'origin/next' into thirteen
[people/pmueller/ipfire-2.x.git] / src / patches / glibc / glibc-rh703480.patch
1 2011-01-15 Ulrich Drepper <drepper@gmail.com>
2
3 [BZ #6812]
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
7 failed.
8
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
14 };
15
16
17 +/* This is the standard reply in case there are temporary problems. */
18 +static const hst_response_header tryagain =
19 +{
20 + .version = NSCD_VERSION,
21 + .found = 0,
22 + .h_name_len = 0,
23 + .h_aliases_cnt = 0,
24 + .h_addrtype = -1,
25 + .h_length = -1,
26 + .h_addr_list_cnt = 0,
27 + .error = TRY_AGAIN
28 +};
29 +
30 +
31 static void
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
35 else
36 {
37 /* We have no data. This means we send the standard reply for this
38 - case. */
39 + case. Possibly this is only temporary. */
40 ssize_t total = sizeof (notfound);
41 + assert (sizeof (notfound) == sizeof (tryagain));
42 +
43 + const hst_response_header *resp = (errval == EAGAIN
44 + ? &tryagain : &notfound);
45
46 if (fd != -1 &&
47 - TEMP_FAILURE_RETRY (send (fd, &notfound, total,
48 + TEMP_FAILURE_RETRY (send (fd, resp, total,
49 MSG_NOSIGNAL)) != total)
50 all_written = false;
51
52 @@ -135,7 +153,7 @@ cache_addhst (struct database_dyn *db, i
53 ? db->negtimeout : ttl);
54
55 /* This is the reply. */
56 - memcpy (&dataset->resp, &notfound, total);
57 + memcpy (&dataset->resp, resp, total);
58
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;
66 errval = EAGAIN;
67 break;
68 }