pidgin: b9539e10: Just add a note that this code sucks
markdoliner at pidgin.im
markdoliner at pidgin.im
Wed Aug 12 21:53:15 EDT 2009
-----------------------------------------------------------------
Revision: b9539e104c591c2ab83b282605eb3af7c4b3795c
Ancestor: 468be347a493f33d93941ee15454b88a9cd44f3e
Author: markdoliner at pidgin.im
Date: 2009-08-13T01:47:54
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b9539e104c591c2ab83b282605eb3af7c4b3795c
Modified files:
libpurple/protocols/msn/directconn.c
ChangeLog:
Just add a note that this code sucks
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/directconn.c 0d0bf0b5ab819d853d38bc2d576895424b7e1ab3
+++ libpurple/protocols/msn/directconn.c 255e1b5e3987031670d14fd45f14318ec336f4fb
@@ -259,6 +259,19 @@ read_cb(gpointer data, gint source, Purp
directconn = data;
/* Let's read the length of the data. */
+#error This code is broken. See the note below.
+ /*
+ * TODO: This has problems! First of all, sizeof(body_len) will be
+ * different on 32bit systems and on 64bit systems (4 bytes
+ * vs. 8 bytes).
+ * Secondly, we're reading from a TCP stream. There is no
+ * guarantee that we have received the number of bytes we're
+ * trying to read. We need to read into a buffer. If read
+ * returns <0 then we need to check errno. If errno is EAGAIN
+ * then don't destroy anything, just exit and wait for more
+ * data. See every other function in libpurple that does this
+ * correctly for an example.
+ */
len = read(directconn->fd, &body_len, sizeof(body_len));
if (len <= 0)
More information about the Commits
mailing list