diff options
author | Martin Willi <martin@revosec.ch> | 2014-11-27 18:15:45 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-11-28 12:45:58 +0100 |
commit | 02fd29acc14630a553ec67f008865859e30859e9 (patch) | |
tree | 34375690d11970366884ba810feef62dfc05b4b2 | |
parent | f1773fee43ae63f9752378498253f059c631d9ec (diff) | |
download | strongswan-02fd29acc14630a553ec67f008865859e30859e9.tar.bz2 strongswan-02fd29acc14630a553ec67f008865859e30859e9.tar.xz |
windows: Properly set errno for read/write functions using Winsock
-rw-r--r-- | src/libstrongswan/utils/compat/windows.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstrongswan/utils/compat/windows.c b/src/libstrongswan/utils/compat/windows.c index e2be64d50..1f22ffa02 100644 --- a/src/libstrongswan/utils/compat/windows.c +++ b/src/libstrongswan/utils/compat/windows.c @@ -651,8 +651,8 @@ ssize_t windows_read(int fd, void *buf, size_t count) { ssize_t ret; - ret = recv(fd, buf, count, 0); - if (ret == -1 && WSAGetLastError() == WSAENOTSOCK) + ret = wserr(recv(fd, buf, count, 0)); + if (ret == -1 && errno == ENOTSOCK) { ret = read(fd, buf, count); } @@ -667,8 +667,8 @@ ssize_t windows_write(int fd, void *buf, size_t count) { ssize_t ret; - ret = send(fd, buf, count, 0); - if (ret == -1 && WSAGetLastError() == WSAENOTSOCK) + ret = wserr(send(fd, buf, count, 0)); + if (ret == -1 && errno == ENOTSOCK) { ret = write(fd, buf, count); } |