This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 14/03/15 18:47, Joshua Rogers wrote:
> HOwever, on the res_query call on line 46, the _res structure is reset.
>
> If we uncomment L26-28, and comment L34, res_query correctly uses _res
> with the custom nsaddr, and does NOT reset _res.
>
> So, to me, this seems like a bug in res_init(), not setting something to
> indicate that it indeed has been initialized.. Or that orielly book is
> wrong.
>
> Using the code:
>
>
> if(_res.options & RES_INIT) {
> printf("RES_INIT set.\n");
> } else {
> printf("RES_INIT not set.\n");
> }
>
> after res_init, indicates RES_INIT is indeed set.
This is incorrect.
_res is not reset.
Or, at least, not completely.
(gdb) n
30 res_init();
(gdb) p _res.options
$1 = 0
(gdb) n
31 _res.options |= (RES_DEBUG|RES_USEVC);
(gdb) p _res.options
$2 = 524993
(gdb) n
32 _res.nscount = 0;
(gdb) p _res.options
$3 = 525003
(gdb) n
35 hp = gethostbyname(argv[1]);
(gdb) n
36 if (!hp) {
(gdb) p _res.options
$4 = 525003
I confirmed (as you can see in the code in the gdb output), that nscount
is reset on the run by gethostbyname, but options is not.
Is this documented behaviour?
Thanks,
--
-- Joshua Rogers <https://internot.info/>
Attachment:
signature.asc
Description: OpenPGP digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |