# HG changeset patch # User Daniel Atallah # Date 1147960091 0 # Node ID cb2060acb34fe78d49d55f89b1721e7d22b2c891 # Parent a5bfc93b530988a59166d1436586c320328ec0c0 [gaim-migrate @ 16190] Added wrapper for send() so that errno is set correctly committer: Tailor Script diff -r a5bfc93b5309 -r cb2060acb34f src/win32/libc_interface.c --- 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); } diff -r a5bfc93b5309 -r cb2060acb34f src/win32/libc_interface.h --- a/src/win32/libc_interface.h Thu May 18 04:47:04 2006 +0000 +++ b/src/win32/libc_interface.h Thu May 18 13:48:11 2006 +0000 @@ -112,6 +112,10 @@ #define recv(fd, buf, len, flags) \ wgaim_recv(fd, buf, len, flags) +int wgaim_send(int fd, const void *buf, unsigned int size, int flags); +#define send(socket, buf, buflen, flags) \ +wgaim_send(socket, buf, buflen, flags) + int wgaim_close(int fd); #define close( fd ) \ wgaim_close( fd )