qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resol


From: Stefan Hajnoczi
Subject: Re: [Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resolv.conf
Date: Fri, 22 Mar 2013 13:14:15 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Mar 08, 2013 at 01:24:20PM +0100, Guillaume Subiron wrote:
> Some users may have only a link-local IPv6 in their resolv.conf. In slirp 
> mode, DNS resolution fails with timeout.
> 
> This adds two messages to alert the user that no DNS have been found instead 
> of just exiting without explanation.
> They are kept printed until the user fixes the issue in /etc/resolv.conf.
> 
> Signed-off-by: Guillaume Subiron <address@hidden>
> ---
>  slirp/slirp.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/slirp/slirp.c b/slirp/slirp.c
> index 0e6e232..1683639 100644
> --- a/slirp/slirp.c
> +++ b/slirp/slirp.c
> @@ -135,8 +135,10 @@ int get_dns_addr(struct in_addr *pdns_addr)
>      }
>  
>      f = fopen("/etc/resolv.conf", "r");
> -    if (!f)
> +    if (!f) {
> +        fprintf(stderr, "Unable to open /etc/resolv.conf\n");
>          return -1;
> +    }
>  
>  #ifdef DEBUG
>      lprint("IP address of your DNS(s): ");
> @@ -168,8 +170,10 @@ int get_dns_addr(struct in_addr *pdns_addr)
>          }
>      }
>      fclose(f);
> -    if (!found)
> +    if (!found) {
> +        fprintf(stderr, "No IPv4 found in /etc/resolv.conf\n");
>          return -1;
> +    }
>      return 0;
>  }

Please use error_report() like other net backends.  You can drop the
newline for error_report().

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]