Mercurial > pidgin
diff src/win32/libc_interface.c @ 13778:cb2060acb34f
[gaim-migrate @ 16190]
Added wrapper for send() so that errno is set correctly
committer: Tailor Script <tailor@pidgin.im>
| author | Daniel Atallah <daniel.atallah@gmail.com> |
|---|---|
| date | Thu, 18 May 2006 13:48:11 +0000 |
| parents | cf292e05a6cc |
| children |
line wrap: on
line diff
--- a/src/win32/libc_interface.c Thu May 18 04:47:04 2006 +0000 +++ b/src/win32/libc_interface.c Thu May 18 13:48:11 2006 +0000 @@ -285,20 +285,25 @@ } } -int wgaim_write(int fd, const void *buf, unsigned int size) { +int wgaim_send(int fd, const void *buf, unsigned int size, int flags) { int ret; - if(wgaim_is_socket(fd)) { - if((ret = send(fd, buf, size, 0)) == SOCKET_ERROR) { - errno = WSAGetLastError(); - if(errno == WSAEWOULDBLOCK) - errno = EAGAIN; - return -1; - } else { - /* success */ - return ret; - } - } else + ret = send(fd, buf, size, flags); + + if (ret == SOCKET_ERROR) { + errno = WSAGetLastError(); + if(errno == WSAEWOULDBLOCK) + errno = EAGAIN; + return -1; + } + return ret; +} + +int wgaim_write(int fd, const void *buf, unsigned int size) { + + if(wgaim_is_socket(fd)) + return wgaim_send(fd, buf, size, 0); + else return write(fd, buf, size); }
