mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Fix attempts option not being respected from resolv.conf
Date: Fri, 21 Apr 2017 17:37:35 -0400	[thread overview]
Message-ID: <20170421213735.GG17319@brightrain.aerifal.cx> (raw)
In-Reply-To: <CACOXvngN2sq0+XcuNedu3xFOWs=3g3Ra9qJqECKeRomXfDMAMw@mail.gmail.com>

On Mon, Apr 03, 2017 at 11:15:12PM +0000, Stefan Sedich wrote:
> After some extensive digging it looks like the attempts option is not being
> used properly in resolv.conf, turns out there is a subtle bug and it does
> not appear to read the value correctly.
> 
> Looking at the old code this did work but must have broken when the
> resolv.conf reading was refactored out, below is the fix for this (first
> time submitting a patch here so hopefully I am doing it right).
> 
> ---
>  src/network/resolvconf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/network/resolvconf.c b/src/network/resolvconf.c
> index 2cf1f475..4c3e4c4b 100644
> --- a/src/network/resolvconf.c
> +++ b/src/network/resolvconf.c
> @@ -45,8 +45,8 @@ int __get_resolv_conf(struct resolvconf *conf, char
> *search, size_t search_sz)
>   if (z != p) conf->ndots = x > 15 ? 15 : x;
>   }
>   p = strstr(line, "attempts:");
> - if (p && isdigit(p[6])) {
> - p += 6;
> + if (p && isdigit(p[9])) {
> + p += 9;
>   unsigned long x = strtoul(p, &z, 10);
>   if (z != p) conf->attempts = x > 10 ? 10 : x;
>   }

Looks fine, but your mailer botched the patch formatting. I've applied
it by hand and added a reference to the commit responsible for the
regression. Thanks.

Rich


  reply	other threads:[~2017-04-21 21:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 23:15 Stefan Sedich
2017-04-21 21:37 ` Rich Felker [this message]
2017-04-21 21:39   ` Stefan Sedich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170421213735.GG17319@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).