diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-09-13 05:41:52 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-09-13 05:41:52 +0000 |
commit | d7ea96a449049db7de8e92d135b1d961c523a351 (patch) | |
tree | ac14ce6a352fc29baeb03af5c9b8f75d76f349ab /libsylph | |
parent | d7a5fbadd02bc9e47459c6280cdfd20d18620803 (diff) |
session.c: added extra error checking when writing to buffer.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1155 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/procmsg.c | 9 | ||||
-rw-r--r-- | libsylph/session.c | 7 |
2 files changed, 12 insertions, 4 deletions
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c index 13141f50..37546154 100644 --- a/libsylph/procmsg.c +++ b/libsylph/procmsg.c @@ -156,10 +156,11 @@ gint procmsg_read_cache_data_str(FILE *fp, gchar **str) #define READ_CACHE_DATA(data, fp) \ { \ if (procmsg_read_cache_data_str(fp, &data) < 0) { \ + g_warning("Cache data is corrupted\n"); \ procmsg_msginfo_free(msginfo); \ procmsg_msg_list_free(mlist); \ - mlist = NULL; \ - break; \ + fclose(fp); \ + return NULL; \ } \ } @@ -171,8 +172,8 @@ gint procmsg_read_cache_data_str(FILE *fp, gchar **str) g_warning("Cache data is corrupted\n"); \ procmsg_msginfo_free(msginfo); \ procmsg_msg_list_free(mlist); \ - mlist = NULL; \ - break; \ + fclose(fp); \ + return NULL; \ } else \ n = idata; \ } diff --git a/libsylph/session.c b/libsylph/session.c index 8e7cd835..b8b77aff 100644 --- a/libsylph/session.c +++ b/libsylph/session.c @@ -839,6 +839,13 @@ static gboolean session_read_data_as_file_cb(SockInfo *source, } session->read_data_pos += write_len; + if (fflush(session->read_data_fp) == EOF) { + perror("fflush"); + g_warning("session_read_data_as_file_cb: " + "writing data to file failed\n"); + session->state = SESSION_ERROR; + return FALSE; + } rewind(session->read_data_fp); /* callback */ |