mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
[windows] Fixes for FSP (send and recv)
This commit is contained in:
parent
2ace5374c8
commit
6f11b9be8b
@ -917,3 +917,37 @@ win32_strerror(int err)
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
int
|
||||
win32_send(int sockfd, const void *buf, unsigned len, int flags)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (sockfd >= SOCK_SHIFT) {
|
||||
sockfd -= SOCK_SHIFT;
|
||||
}
|
||||
rc = send(sockfd, buf, len, flags);
|
||||
|
||||
if (rc != len) {
|
||||
errno = WSAGetLastError();
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
win32_recv(int sockfd, void *buf, unsigned len, int flags)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (sockfd >= SOCK_SHIFT) {
|
||||
sockfd -= SOCK_SHIFT;
|
||||
}
|
||||
rc = recv(sockfd, buf, len, flags);
|
||||
|
||||
if (rc < 0) {
|
||||
errno = WSAGetLastError();
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -31,7 +31,8 @@ int win32_ioctl(int fd, long option, int *flag);
|
||||
int win32_select(int num_fds, struct fd_set *rd, struct fd_set *wr,
|
||||
struct fd_set *ex, struct timeval *tv);
|
||||
char *win32_strerror(int err);
|
||||
|
||||
int win32_send(int sockfd, const void *buf, unsigned len, int flags);
|
||||
int win32_recv(int sockfd, void *buf, unsigned len, int flags);
|
||||
|
||||
#ifndef WIN32_OVERRIDES_SELF
|
||||
|
||||
@ -50,6 +51,8 @@ char *win32_strerror(int err);
|
||||
#define ioctl(fd,opt,flag) win32_ioctl(fd, opt, flag)
|
||||
#define select win32_select
|
||||
#define strerror(err) win32_strerror(err)
|
||||
#define send win32_send
|
||||
#define recv win32_recv
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user