Module Name:    xsrc
Committed By:   bouyer
Date:           Sun Nov 15 17:44:01 UTC 2015

Modified Files:
        xsrc/xfree/xc/programs/xdm [netbsd-6]: access.c

Log Message:
Pull up following revision(s) (requested by dholland in ticket #1324):
        xsrc/xfree/xc/programs/xdm/access.c: revision 1.2
Don't crash if the local hostname doesn't resolve. PR 26998


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.1.1.8.14.1 xsrc/xfree/xc/programs/xdm/access.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/xfree/xc/programs/xdm/access.c
diff -u xsrc/xfree/xc/programs/xdm/access.c:1.1.1.8 xsrc/xfree/xc/programs/xdm/access.c:1.1.1.8.14.1
--- xsrc/xfree/xc/programs/xdm/access.c:1.1.1.8	Fri Mar 18 13:09:17 2005
+++ xsrc/xfree/xc/programs/xdm/access.c	Sun Nov 15 17:44:01 2015
@@ -138,8 +138,16 @@ getLocalAddress (void)
 	struct hostent	*hostent;
 
 	hostent = gethostbyname (localHostname());
-	XdmcpAllocARRAY8 (&localAddress, hostent->h_length);
-	memmove( localAddress.data, hostent->h_addr, hostent->h_length);
+	if (hostent) {
+		XdmcpAllocARRAY8 (&localAddress, hostent->h_length);
+		memmove( localAddress.data, hostent->h_addr, hostent->h_length);
+	} else {
+	    XdmcpAllocARRAY8 (&localAddress, 4);
+	    localAddress.data[0] = 127;
+	    localAddress.data[1] = 0;
+	    localAddress.data[2] = 0;
+	    localAddress.data[3] = 1;
+	}
 #endif
 
     }

Reply via email to