From 38bcdc42b52c539273848f734421e13b2bd2a50a Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 21 Nov 2011 08:40:17 -0500 Subject: upas: fix segfault when host not found R=rsc CC=plan9port.codebot http://codereview.appspot.com/5370105 --- src/cmd/upas/common/libsys.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cmd/upas') diff --git a/src/cmd/upas/common/libsys.c b/src/cmd/upas/common/libsys.c index 8e55fc4d..b439cfde 100644 --- a/src/cmd/upas/common/libsys.c +++ b/src/cmd/upas/common/libsys.c @@ -465,6 +465,9 @@ sysnames_read(void) return namev; h = gethostbyname(alt_sysname_read()); + if(h == nil) + return 0; + for(p=h->h_aliases; *p; p++) ; @@ -491,7 +494,7 @@ domainname_read(void) char **namev, *p; Ndbtuple *t; - for(namev = sysnames_read(); *namev; namev++){ + for(namev = sysnames_read(); namev && *namev; namev++){ if(strchr(*namev, '.')){ for(p=*namev-1; p && *++p; p=strchr(p, '.')){ if((t = dnsquery(nil, p, "mx")) != nil){ -- cgit v1.2.3