qemu-trivial
[Top][All Lists]
Advanced

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

[Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resolv.co


From: Guillaume Subiron
Subject: [Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resolv.conf
Date: Fri, 8 Mar 2013 13:24:20 +0100

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;
 }
 
-- 
Guillaume




reply via email to

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