aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-12 08:46:49 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-12 08:46:49 +0000
commit7b0ca5ffe4f2074dce460b501ba70374bebd5f77 (patch)
treecddb2e0644553b0e77531155719a8389d3407e42 /libsylph
parent38511cacbbe75f5d2a68c2679d878ba4f3f3cd28 (diff)
also log IMAP4 literal strings.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@639 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/imap.c4
-rw-r--r--libsylph/recv.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/libsylph/imap.c b/libsylph/imap.c
index 0f75f73c..38bce92a 100644
--- a/libsylph/imap.c
+++ b/libsylph/imap.c
@@ -3756,6 +3756,10 @@ static gint imap_cmd_ok(IMAPSession *session, GPtrArray *argbuf)
ok = IMAP_SOCKET;
break;
}
+ if (memchr(literal, '\n', len))
+ log_print("IMAP4< (literal: %d bytes)\n", len);
+ else
+ log_print("IMAP4< %s\n", literal);
g_string_append(str, "\r\n");
g_string_append_len(str, literal, len);
diff --git a/libsylph/recv.c b/libsylph/recv.c
index 0b71545c..3d2a7968 100644
--- a/libsylph/recv.c
+++ b/libsylph/recv.c
@@ -45,19 +45,21 @@ gchar *recv_bytes(SockInfo *sock, glong size)
if (size == 0)
return NULL;
- buf = g_malloc(size);
+ buf = g_malloc(size + 1);
do {
gint read_count;
read_count = sock_read(sock, buf + count, size - count);
- if (read_count < 0) {
+ if (read_count <= 0) {
g_free(buf);
return NULL;
}
count += read_count;
} while (count < size);
+ buf[size] = '\0';
+
return buf;
}