X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fplatform%2Fposix%2Fos-socket.h;h=036be3f5c2227deffa92ea2250244cf350fb3fdd;hb=3b2bd169c03f74ccca35d9e211bbbc1308c33675;hp=468cc3deb4dfa075a60bff9cd2ca899e8ac0d5d8;hpb=996665192725398172263999b88c63663d11db04;p=deb_libcec.git diff --git a/src/lib/platform/posix/os-socket.h b/src/lib/platform/posix/os-socket.h index 468cc3d..036be3f 100644 --- a/src/lib/platform/posix/os-socket.h +++ b/src/lib/platform/posix/os-socket.h @@ -43,6 +43,11 @@ #include #include +/* Needed on Mac OS/X */ +#ifndef SOL_TCP +#define SOL_TCP IPPROTO_TCP +#endif + namespace PLATFORM { // Standard sockets @@ -71,7 +76,7 @@ namespace PLATFORM if (socket == INVALID_SOCKET_VALUE) { *iError = EINVAL; - return -1; + return -EINVAL; } ssize_t iBytesWritten(0); @@ -85,19 +90,19 @@ namespace PLATFORM if (returnv < 0) { *iError = errno; - return -1; + return -errno; } else if (returnv == 0) { *iError = ETIMEDOUT; - return -1; + return -ETIMEDOUT; } returnv = write(socket, (char*)data + iBytesWritten, len - iBytesWritten); if (returnv == -1) { *iError = errno; - return -1; + return -errno; } iBytesWritten += returnv; } @@ -116,7 +121,7 @@ namespace PLATFORM if (socket == INVALID_SOCKET_VALUE) { *iError = EINVAL; - return -1; + return -EINVAL; } if (iTimeoutMs > 0) @@ -145,7 +150,7 @@ namespace PLATFORM if (returnv == -1) { *iError = errno; - return -1; + return -errno; } else if (returnv == 0) { @@ -156,7 +161,7 @@ namespace PLATFORM if (returnv == -1) { *iError = errno; - return -1; + return -errno; } iBytesRead += returnv; @@ -205,7 +210,7 @@ namespace PLATFORM if (socket == INVALID_SOCKET_VALUE) { *iError = EINVAL; - return -1; + return -EINVAL; } if (iTimeoutMs > 0)