changeset 12749:13276711babc

[gaim-migrate @ 15096] This allows us to access the errors, I might need to do something with the blocking for this. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 07 Jan 2006 06:30:27 +0000
parents dd271caf25b0
children 1deb504f069a
files src/win32/libc_interface.c src/win32/libc_interface.h
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/win32/libc_interface.c	Sat Jan 07 03:56:15 2006 +0000
+++ b/src/win32/libc_interface.c	Sat Jan 07 06:30:27 2006 +0000
@@ -311,12 +311,22 @@
 			/* success */
 			return ret;
 		}
-		    
 	}
 	else
 		return write(fd, buf, size);
 }
 
+int wgaim_recv(int fd, void *buf, size_t len, int flags) {
+	int ret;
+
+	if ((ret = recv(fd, buf, len, flags)) == SOCKET_ERROR) {
+			errno = WSAGetLastError();
+			return -1;
+	} else {
+		return ret;
+	}
+}
+
 int wgaim_close(int fd) {
 	int ret;
 
--- a/src/win32/libc_interface.h	Sat Jan 07 03:56:15 2006 +0000
+++ b/src/win32/libc_interface.h	Sat Jan 07 06:30:27 2006 +0000
@@ -108,6 +108,10 @@
 #define write( socket, buf, buflen ) \
 wgaim_write( socket, buf, buflen )
 
+int wgaim_recv(int fd, void *buf, size_t len, int flags);
+#define recv(fd, buf, len, flags) \
+wgaim_recv(fd, buf, len, flags)
+
 int wgaim_close(int fd);
 #define close( fd ) \
 wgaim_close( fd )