]> git.mxchange.org Git - simgear.git/commitdiff
Check for valid hostname lookup in sg_socket.cxx.
authorcurt <curt>
Tue, 10 Jul 2001 14:13:51 +0000 (14:13 +0000)
committercurt <curt>
Tue, 10 Jul 2001 14:13:51 +0000 (14:13 +0000)
simgear/io/sg_socket.cxx

index 144c64dfa8a9b75802fa34a1713dc8b6a41bc25d..905639b91d2c01f437dbe9a01d2b9827246f5658 100644 (file)
@@ -132,6 +132,10 @@ SGSocket::SocketType SGSocket::make_client_socket () {
 
     // get the hosts official name/info
     hp = gethostbyname( hostname.c_str() );
+    if (hp == NULL) {
+       SG_LOG( SG_IO, SG_ALERT, "Error: hostname lookup failed" );
+       return INVALID_SOCKET;
+    }
 
     // Connect this socket to the host and the port specified on the
     // command line