From 7b0ca5ffe4f2074dce460b501ba70374bebd5f77 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 12 Oct 2005 08:46:49 +0000 Subject: also log IMAP4 literal strings. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@639 ee746299-78ed-0310-b773-934348b2243d --- libsylph/imap.c | 4 ++++ libsylph/recv.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'libsylph') 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; } -- cgit v1.2.3