- more NULL checking for safer execution

- added safer mutex guards in custom game menu
This commit is contained in:
Mark Vejvoda
2010-08-20 22:42:26 +00:00
parent 0e82836e01
commit d69fbc6925
2 changed files with 16 additions and 8 deletions

View File

@@ -1228,10 +1228,17 @@ bool Socket::isConnected() {
}
string Socket::getHostName() {
const int strSize= 256;
const int strSize= 257;
char hostname[strSize]="";
gethostname(hostname, strSize);
return (hostname[0] != '\0' ? hostname : "");
int result = gethostname(hostname, strSize);
string host = "";
if(result == 0) {
host = (hostname[0] != '\0' ? hostname : "");
}
else {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] result = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,result,getLastSocketErrorText());
}
return host;
}
string Socket::getIp() {