aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/rdr/FdInStream.cxx12
-rw-r--r--common/rdr/FdOutStream.cxx12
2 files changed, 12 insertions, 12 deletions
diff --git a/common/rdr/FdInStream.cxx b/common/rdr/FdInStream.cxx
index 13d3a5a8..4ddd1221 100644
--- a/common/rdr/FdInStream.cxx
+++ b/common/rdr/FdInStream.cxx
@@ -26,14 +26,14 @@
#include <sys/time.h>
#ifdef _WIN32
#include <winsock2.h>
+#define errorNumber WSAGetLastError()
#define close closesocket
-#undef errno
-#define errno WSAGetLastError()
#include <os/winerrno.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
+#define errorNumber errno
#endif
/* Old systems have select() in sys/time.h */
@@ -89,20 +89,20 @@ size_t FdInStream::readFd(void* buf, size_t len)
FD_ZERO(&fds);
FD_SET(fd, &fds);
n = select(fd+1, &fds, 0, 0, &tv);
- } while (n < 0 && errno == EINTR);
+ } while (n < 0 && errorNumber == EINTR);
if (n < 0)
- throw SystemException("select",errno);
+ throw SystemException("select", errorNumber);
if (n == 0)
return 0;
do {
n = ::recv(fd, (char*)buf, len, 0);
- } while (n < 0 && errno == EINTR);
+ } while (n < 0 && errorNumber == EINTR);
if (n < 0)
- throw SystemException("read",errno);
+ throw SystemException("read", errorNumber);
if (n == 0)
throw EndOfStream();
diff --git a/common/rdr/FdOutStream.cxx b/common/rdr/FdOutStream.cxx
index f89fd345..e630a4d7 100644
--- a/common/rdr/FdOutStream.cxx
+++ b/common/rdr/FdOutStream.cxx
@@ -27,8 +27,7 @@
#include <errno.h>
#ifdef _WIN32
#include <winsock2.h>
-#undef errno
-#define errno WSAGetLastError()
+#define errorNumber WSAGetLastError()
#include <os/winerrno.h>
#else
#include <sys/types.h>
@@ -37,6 +36,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#define errorNumber errno
#endif
/* Old systems have select() in sys/time.h */
@@ -109,10 +109,10 @@ size_t FdOutStream::writeFd(const void* data, size_t length)
FD_ZERO(&fds);
FD_SET(fd, &fds);
n = select(fd+1, 0, &fds, 0, &tv);
- } while (n < 0 && errno == EINTR);
+ } while (n < 0 && errorNumber == EINTR);
if (n < 0)
- throw SystemException("select", errno);
+ throw SystemException("select", errorNumber);
if (n == 0)
return 0;
@@ -126,10 +126,10 @@ size_t FdOutStream::writeFd(const void* data, size_t length)
#else
n = ::send(fd, (const char*)data, length, MSG_DONTWAIT);
#endif
- } while (n < 0 && (errno == EINTR));
+ } while (n < 0 && (errorNumber == EINTR));
if (n < 0)
- throw SystemException("write", errno);
+ throw SystemException("write", errorNumber);
gettimeofday(&lastWrite, NULL);