mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-06 00:00:47 -04:00
windows: Provide a write(2) wrapper that uses send(2) on sockets
This commit is contained in:
parent
09624c6cec
commit
a301a9c939
@ -659,6 +659,22 @@ ssize_t windows_read(int fd, void *buf, size_t count)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* See header
|
||||
*/
|
||||
#undef write
|
||||
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 = write(fd, buf, count);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* See header
|
||||
*/
|
||||
|
@ -371,6 +371,12 @@ ssize_t windows_sendto(int sockfd, const void *buf, size_t len, int flags,
|
||||
#define read windows_read
|
||||
ssize_t windows_read(int fd, void *buf, size_t count);
|
||||
|
||||
/**
|
||||
* write(2) working on files and sockets
|
||||
*/
|
||||
#define write windows_write
|
||||
ssize_t windows_write(int fd, void *buf, size_t count);
|
||||
|
||||
#if _WIN32_WINNT < 0x0600
|
||||
/**
|
||||
* Define pollfd and flags on our own if not specified
|
||||
|
Loading…
x
Reference in New Issue
Block a user