1
0

Simplify ifdef. Makes compiling possible on BSD

git-svn-id: http://mc-server.googlecode.com/svn/trunk@577 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
cedeel@gmail.com 2012-06-08 12:23:56 +00:00
parent fbabf9ee8c
commit bda3b96681

View File

@ -111,16 +111,7 @@ AString cSocket::GetErrorString( int a_ErrNo )
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
#if ((((_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600)) && ! _GNU_SOURCE && !__APPLE__) || __CYGWIN32__ || __APPLE__ ) // XSI version of strerror_r():
int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
if( res == 0 )
{
Printf(Out, "%d: %s", a_ErrNo, buffer);
return Out;
}
#else // GNU version of strerror_r()
#if ( _GNU_SOURCE ) // GNU version of strerror_r()
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
if( res != NULL )
@ -129,6 +120,15 @@ AString cSocket::GetErrorString( int a_ErrNo )
return Out;
}
#else // XSI version of strerror_r():
int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
if( res == 0 )
{
Printf(Out, "%d: %s", a_ErrNo, buffer);
return Out;
}
#endif // strerror_r() version
else