aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/upas
diff options
context:
space:
mode:
authorDavid du Colombier <0intro@gmail.com>2011-11-21 08:40:17 -0500
committerRuss Cox <rsc@swtch.com>2011-11-21 08:40:17 -0500
commit38bcdc42b52c539273848f734421e13b2bd2a50a (patch)
tree6142c7b546c10b1b99091bc0934a97cac0f99d66 /src/cmd/upas
parent81c30b5a75cb5ae9a5175321a5f8a6049f0ac4e3 (diff)
downloadplan9port-38bcdc42b52c539273848f734421e13b2bd2a50a.tar.gz
plan9port-38bcdc42b52c539273848f734421e13b2bd2a50a.tar.bz2
plan9port-38bcdc42b52c539273848f734421e13b2bd2a50a.zip
upas: fix segfault when host not found
R=rsc CC=plan9port.codebot http://codereview.appspot.com/5370105
Diffstat (limited to 'src/cmd/upas')
-rw-r--r--src/cmd/upas/common/libsys.c5
1 files changed, 4 insertions, 1 deletions
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){