1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include <config.h>
- #define WIN32_LEAN_AND_MEAN
- #include <sys/socket.h>
- #include "w32sock.h"
- #undef recvfrom
- ssize_t
- rpl_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from,
- socklen_t *fromlen)
- {
- SOCKET sock = FD_TO_SOCKET (fd);
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int frombufsize = (from != NULL ? *fromlen : 0);
- int r = recvfrom (sock, buf, len, flags, from, fromlen);
- if (r < 0)
- set_winsock_errno ();
-
- else if (from != NULL && *fromlen == frombufsize)
- rpl_getpeername (fd, from, fromlen);
- return r;
- }
- }
|