summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/libc/minires-os-if.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-01-12 16:38:02 +0000
committerCorinna Vinschen <corinna@vinschen.de>2015-01-12 16:38:02 +0000
commit7d0b0134ee443539f04a18b0ef7f01e92af149b3 (patch)
tree2b7ccc9f33231b4119d6668132b8cddd64bb4d18 /winsup/cygwin/libc/minires-os-if.c
parent8ddeb7008e806b7df619f51340bff2d41a8a68d4 (diff)
downloadcygnal-7d0b0134ee443539f04a18b0ef7f01e92af149b3.tar.gz
cygnal-7d0b0134ee443539f04a18b0ef7f01e92af149b3.tar.bz2
cygnal-7d0b0134ee443539f04a18b0ef7f01e92af149b3.zip
* minires-os-if.c (cygwin_query): Change questions into answers.
Diffstat (limited to 'winsup/cygwin/libc/minires-os-if.c')
-rw-r--r--winsup/cygwin/libc/minires-os-if.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c
index 94460ffb2..05fc95f5f 100644
--- a/winsup/cygwin/libc/minires-os-if.c
+++ b/winsup/cygwin/libc/minires-os-if.c
@@ -249,6 +249,13 @@ static int cygwin_query(res_state statp, const char * DomName, int Class, int Ty
rr = pQueryResultsSet;
section = 0;
while (rr) {
+ /* Some Windows versions return questions when providing locally generated
+ answers, for example for "localhost" or for the computer name. */
+ if (((rr->Flags.DW & 0x3) == DnsSectionQuestion) &&
+ (rr->wDataLength > 0)) {
+ DPRINTF(debug, "Changing record below from question to answer\n");
+ rr->Flags.DW ^= DnsSectionQuestion ^ DnsSectionAnswer;
+ }
if (!counts[0] && (rr->Flags.DW & 0x3)) {
/* No question. Adopt the first name as the name in the question */
if ((len = dn_comp(rr->pName, ptr, AnsLength - 4,