[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[DDL-ML] Patch f. dtcltiny
Falls man den hostname falsch schrieb (schon mal loclhost probiert?
:-) gabs core. gethostbyname() return value check!
Harald.
*** MainWindow.cpp.orig Sun Dec 10 16:31:06 2000
--- MainWindow.cpp Wed Jan 10 14:54:19 2001
***************
*** 66,72 ****
struct sockaddr_in socketAddr;
bzero( &socketAddr, sizeof( socketAddr ) );
! ServerHost = gethostbyname( cHostName );
socketAddr.sin_family = ServerHost->h_addrtype;
memcpy( &socketAddr.sin_addr, ServerHost->h_addr_list[0],
--- 66,76 ----
struct sockaddr_in socketAddr;
bzero( &socketAddr, sizeof( socketAddr ) );
! if ((ServerHost = gethostbyname( cHostName )) == NULL)
! {
! fprintf(stderr, "gethostbyname() says host not found\n" );
! exit( 255 );
! }
socketAddr.sin_family = ServerHost->h_addrtype;
memcpy( &socketAddr.sin_addr, ServerHost->h_addr_list[0],