Revision: 16190
Author: datallah
Date: 2006-05-18 06:48:11 -0700 (Thu, 18 May 2006)
ViewCVS: http://svn.sourceforge.net/gaim/?rev=16190&view=rev
Log Message:
-----------
Added wrapper for send() so that errno is set correctly
Modified Paths:
--------------
trunk/src/win32/libc_interface.c
trunk/src/win32/libc_interface.h
Modified: trunk/src/win32/libc_interface.c
===================================================================
--- trunk/src/win32/libc_interface.c 2006-05-18 04:47:04 UTC (rev 16189)
+++ trunk/src/win32/libc_interface.c 2006-05-18 13:48:11 UTC (rev 16190)
@@ -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);
}
Modified: trunk/src/win32/libc_interface.h
===================================================================
--- trunk/src/win32/libc_interface.h 2006-05-18 04:47:04 UTC (rev 16189)
+++ trunk/src/win32/libc_interface.h 2006-05-18 13:48:11 UTC (rev 16190)
@@ -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 )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|