From bda3b96681df645a8df43b273f6acebce7760e72 Mon Sep 17 00:00:00 2001 From: "cedeel@gmail.com" Date: Fri, 8 Jun 2012 12:23:56 +0000 Subject: Simplify ifdef. Makes compiling possible on BSD git-svn-id: http://mc-server.googlecode.com/svn/trunk@577 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cSocket.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/cSocket.cpp b/source/cSocket.cpp index 595b423b8..7fc67e258 100644 --- a/source/cSocket.cpp +++ b/source/cSocket.cpp @@ -111,21 +111,21 @@ 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(): + #if ( _GNU_SOURCE ) // GNU version of strerror_r() - int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) ); - if( res == 0 ) + char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) ); + if( res != NULL ) { - Printf(Out, "%d: %s", a_ErrNo, buffer); + Printf(Out, "%d: %s", a_ErrNo, res); return Out; } - #else // GNU version of strerror_r() + #else // XSI version of strerror_r(): - char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) ); - if( res != NULL ) + int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) ); + if( res == 0 ) { - Printf(Out, "%d: %s", a_ErrNo, res); + Printf(Out, "%d: %s", a_ErrNo, buffer); return Out; } -- cgit v1.2.3