From 2bb2bc543731c539f143a0b029c562b44cdf24cd Mon Sep 17 00:00:00 2001 From: Miguel Angel Marchuet Frutos Date: Mon, 30 Jun 2008 14:57:17 +0000 Subject: [PATCH] 2008-06-30 17:00 UTC+0100 Miguel Angel Marchuet * source/rtl/hbinet.c + Added define SOCKET_ERROR, that is missing in some compilers. --- harbour/ChangeLog | 4 ++++ harbour/source/rtl/hbinet.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c7447ae4ae..ffd874202e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,10 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-06-30 17:00 UTC+0100 Miguel Angel Marchuet + * source/rtl/hbinet.c + + Added define SOCKET_ERROR, that is missing in some compilers. + 2008-06-30 16:36 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbtip/tests/tiptest.prg ! Remove strings as arrays access. Thanks Lorenzo. diff --git a/harbour/source/rtl/hbinet.c b/harbour/source/rtl/hbinet.c index 31d93a650c..e64446ce7f 100644 --- a/harbour/source/rtl/hbinet.c +++ b/harbour/source/rtl/hbinet.c @@ -226,6 +226,12 @@ static void hb_inetLinuxSigusrHandle( int sig ) } #endif +// some compilers has missing this define +#ifndef SOCKET_ERROR +#define SOCKET_ERROR (-1) +#endif + + /* JC1: we need it volatile to be minimally thread safe. */ static volatile int s_iSessions = 0; @@ -472,10 +478,10 @@ static int hb_socketConnect( HB_SOCKET_STRUCT *Socket ) int value; socklen_t len = sizeof(value); - if( getsockopt( Socket->com, SOL_SOCKET, SO_SNDBUF, (char *) &value, &len ) == 0 ) + if( getsockopt( Socket->com, SOL_SOCKET, SO_SNDBUF, (char *) &value, &len ) != SOCKET_ERROR ) { Socket->iSndBufSize = value; - if( getsockopt( Socket->com, SOL_SOCKET, SO_RCVBUF, (char *) &value, &len ) == 0 ) + if( getsockopt( Socket->com, SOL_SOCKET, SO_RCVBUF, (char *) &value, &len ) != SOCKET_ERROR ) { Socket->iRcvBufSize = value; }