Cygwin: resolver: Process options forward (not backwards)

Also, make sure the debug setting propagates to the parser of
the remainder of /etc/resolv.conf
This commit is contained in:
Anton Lavrentiev via Cygwin-patches 2022-01-18 11:09:33 -05:00 committed by Corinna Vinschen
parent 84ff8d9477
commit fa279a583d
1 changed files with 6 additions and 4 deletions

View File

@ -86,12 +86,12 @@ Read options
***********************************************************************/ ***********************************************************************/
static void get_options(res_state statp, int i, char **words) static void get_options(res_state statp, int n, char **words)
{ {
char *ptr; char *ptr;
int value; int i, value;
while (i-- > 0) { for (i = 0; i < n; ++i) {
if (!strcasecmp("debug", words[i])) { if (!strcasecmp("debug", words[i])) {
statp->options |= RES_DEBUG; statp->options |= RES_DEBUG;
DPRINTF(statp->options & RES_DEBUG, "%s: 1\n", words[i]); DPRINTF(statp->options & RES_DEBUG, "%s: 1\n", words[i]);
@ -208,8 +208,10 @@ static void get_resolv(res_state statp)
} }
} }
/* Options line */ /* Options line */
else if (!strncasecmp("options", words[0], sizes[0])) else if (!strncasecmp("options", words[0], sizes[0])) {
get_options(statp, i - 1, &words[1]); get_options(statp, i - 1, &words[1]);
debug = statp->options & RES_DEBUG;
}
} }
} }
fclose(fd); fclose(fd);