mirror of
https://github.com/glest/glest-source.git
synced 2025-08-26 01:23:35 +02:00
updated ping code to properly work for windows
This commit is contained in:
@@ -584,7 +584,7 @@ void createDirectoryPaths(string Path)
|
||||
{
|
||||
//if (':' != *(path-1))
|
||||
{
|
||||
#ifdef _mkdir
|
||||
#if defined(_mkdir) || defined(WIN32)
|
||||
_mkdir(DirName);
|
||||
#elif defined(mkdir)
|
||||
mkdir(DirName, S_IRWXO);
|
||||
@@ -594,7 +594,7 @@ void createDirectoryPaths(string Path)
|
||||
*dirName++ = *path++;
|
||||
*dirName = '\0';
|
||||
}
|
||||
#ifdef _mkdir
|
||||
#if defined(_mkdir) || defined(WIN32)
|
||||
_mkdir(DirName);
|
||||
#elif defined(mkdir)
|
||||
mkdir(DirName, S_IRWXO);
|
||||
|
@@ -1761,12 +1761,11 @@ float Socket::getAveragePingMS(std::string host, int pingCount) {
|
||||
sprintf(szCmd,"ping -c %d %s",pingCount,host.c_str());
|
||||
#endif
|
||||
if(szCmd[0] != '\0') {
|
||||
#ifdef _popen
|
||||
FILE *ping= _popen(szCmd, "r");
|
||||
#elif defined popen
|
||||
FILE *ping= popen(szCmd, "r");
|
||||
#else
|
||||
FILE *ping=NULL;
|
||||
FILE *ping= NULL;
|
||||
#if defined(_popen) || defined(WIN32)
|
||||
ping= _popen(szCmd, "r");
|
||||
#elif defined(popen)
|
||||
ping= popen(szCmd, "r");
|
||||
#endif
|
||||
if (ping != NULL){
|
||||
char buf[4000]="";
|
||||
@@ -1775,9 +1774,9 @@ float Socket::getAveragePingMS(std::string host, int pingCount) {
|
||||
char *data = fgets(&buf[bufferPos], 256, ping);
|
||||
bufferPos = strlen(buf);
|
||||
}
|
||||
#ifdef _pclose
|
||||
#if defined(_pclose) || defined(WIN32)
|
||||
_pclose(ping);
|
||||
#elif defined popen
|
||||
#elif defined(pclose)
|
||||
pclose(ping);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user