changeset 2169:b7807144bf44

[gaim-migrate @ 2179] better reading committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 27 Aug 2001 04:53:19 +0000
parents 74947d32d3c6
children c24595d3c364
files src/protocols/msn/msn.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Mon Aug 27 03:47:31 2001 +0000
+++ b/src/protocols/msn/msn.c	Mon Aug 27 04:53:19 2001 +0000
@@ -730,7 +730,7 @@
 		char *user, *tmp = buf;
 		int length;
 		char *msg, *skiphead, *utf, *final;
-		int len;
+		int len, r;
 
 		GET_NEXT(tmp);
 		user = tmp;
@@ -742,11 +742,13 @@
 
 		msg = g_new0(char, MAX(length + 1, MSN_BUF_LEN));
 
-		if (read(md->fd, msg, length) != length) {
-			g_free(msg);
-			hide_login_progress(gc, "Unable to read message");
-			signoff(gc);
-			return;
+		for (len = 0; len < length; len += r) {
+			if ((r = read(md->fd, msg+len, length-len)) <= 0) {
+				g_free(msg);
+				hide_login_progress(gc, "Unable to read message");
+				signoff(gc);
+				return;
+			}
 		}
 
 		if (!g_strcasecmp(user, "hotmail")) {