diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-11-08 15:59:42 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-11-08 15:59:42 +0100 |
commit | e5cdadd6deca3c0d2af6bc0ab2b60a11f5c6ad4a (patch) | |
tree | 26302e9692c768afe820f1024583fbe681087432 /common/rdr/FdInStream.cxx | |
parent | bf003e5b1edf2877e1f47db41938bfe4ae7816b0 (diff) | |
download | tigervnc-e5cdadd6deca3c0d2af6bc0ab2b60a11f5c6ad4a.tar.gz tigervnc-e5cdadd6deca3c0d2af6bc0ab2b60a11f5c6ad4a.zip |
Fully standardise on send()/recv()
We already assume sockets here since we use select().
Diffstat (limited to 'common/rdr/FdInStream.cxx')
-rw-r--r-- | common/rdr/FdInStream.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/rdr/FdInStream.cxx b/common/rdr/FdInStream.cxx index a8b30857..011ebf41 100644 --- a/common/rdr/FdInStream.cxx +++ b/common/rdr/FdInStream.cxx @@ -26,13 +26,13 @@ #include <sys/time.h> #ifdef _WIN32 #include <winsock2.h> -#define read(s,b,l) recv(s,(char*)b,l,0) #define close closesocket #undef errno #define errno WSAGetLastError() #include <os/winerrno.h> #else #include <sys/types.h> +#include <sys/socket.h> #include <unistd.h> #endif @@ -165,9 +165,9 @@ int FdInStream::overrun(int itemSize, int nItems, bool wait) // blockCallback is set, it will be called (repeatedly) instead of blocking. // If alternatively there is a timeout set and that timeout expires, it throws // a TimedOut exception. Otherwise it returns the number of bytes read. It -// never attempts to read() unless select() indicates that the fd is readable - +// never attempts to recv() unless select() indicates that the fd is readable - // this means it can be used on an fd which has been set non-blocking. It also -// has to cope with the annoying possibility of both select() and read() +// has to cope with the annoying possibility of both select() and recv() // returning EINTR. // @@ -207,7 +207,7 @@ int FdInStream::readWithTimeoutOrCallback(void* buf, int len, bool wait) } do { - n = ::read(fd, buf, len); + n = ::recv(fd, (char*)buf, len, 0); } while (n < 0 && errno == EINTR); if (n < 0) throw SystemException("read",errno); |