diff options
author | 1 <NotZed@Ximian.com> | 2001-11-01 07:55:45 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-11-01 07:55:45 +0800 |
commit | 7a1dfcef582242643fabd50688e0421ff398d645 (patch) | |
tree | 1bbc1b506677140cece96a969f91b27b19c4e703 /camel/camel-mime-parser.c | |
parent | 49bad8cf37fc85a59fb6d2ea199770b33a92f458 (diff) | |
download | gsoc2013-evolution-7a1dfcef582242643fabd50688e0421ff398d645.tar.gz gsoc2013-evolution-7a1dfcef582242643fabd50688e0421ff398d645.tar.zst gsoc2013-evolution-7a1dfcef582242643fabd50688e0421ff398d645.zip |
Same as below.
2001-10-31 <NotZed@Ximian.com>
* providers/local/camel-spool-folder.c (spool_get_message): Same
as below.
* providers/local/camel-maildir-folder.c (maildir_get_message):
Same as below.
* providers/local/camel-mbox-folder.c (mbox_get_message): Set
USER_CANCEL if failed due to EINTR.
* camel-filter-driver.c (camel_filter_driver_filter_mbox): If
construct from parser fails due to user cancel, set USER_CANCEL on
exception.
* camel-mime-part.c (construct_from_parser): Return error if the
parser had an io error.
* camel-mime-message.c (construct_from_parser): Check error on
parser/return error.
* camel-mime-parser.c (folder_scan_init): Init error number.
(camel_mime_parser_errno): New function, return errno of any io
failures.
(folder_read): Set errno if a failure occured.
(folder_seek): Same.
(folder_scan_init_with_fd): Setup errno depeding on ok/failure.
(folder_scan_init_with_stream): Same.
svn path=/trunk/; revision=14559
Diffstat (limited to 'camel/camel-mime-parser.c')
-rw-r--r-- | camel/camel-mime-parser.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index b0ba504457..a53e0716a7 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -212,6 +212,8 @@ struct _header_scan_state { int fd; /* input for a fd input */ CamelStream *stream; /* or for a stream */ + int ioerrno; /* io error state */ + /* for scanning input buffers */ char *realbuf; /* the real buffer, SCAN_HEAD*2 + SCAN_BUF bytes */ char *inbuf; /* points to a subset of the allocated memory, the underflow */ @@ -944,6 +946,14 @@ int camel_mime_parser_fd(CamelMimeParser *m) return s->fd; } +/* Return errno of the parser, incase any error occured during processing */ +int camel_mime_parser_errno(CamelMimeParser *m) +{ + struct _header_scan_state *s = _PRIVATE(m); + + return s->ioerrno; +} + /* ********************************************************************** */ /* Implementation */ /* ********************************************************************** */ @@ -978,6 +988,8 @@ folder_read(struct _header_scan_state *s) s->inptr = s->inbuf; s->inend = s->inbuf+len+inoffset; r(printf("content = %d '%.*s'\n",s->inend - s->inptr, s->inend - s->inptr, s->inptr)); + } else { + s->ioerrno = errno?errno:EIO; } g_assert(s->inptr<=s->inend); @@ -1035,8 +1047,12 @@ folder_seek(struct _header_scan_state *s, off_t offset, int whence) if (len>=0) { s->inend = s->inbuf+len; s->inend[0] = '\n'; - } else + } else { newoffset = -1; + s->ioerrno = errno?errno:EIO; + } + } else { + s->ioerrno = errno?errno:EIO; } #ifdef PURIFY inend_id = purify_watch(&s->inend); @@ -1474,6 +1490,7 @@ folder_scan_init(void) s->fd = -1; s->stream = NULL; + s->ioerrno = 0; s->outbuf = g_malloc(1024); s->outptr = s->outbuf; @@ -1523,8 +1540,10 @@ folder_scan_init_with_fd(struct _header_scan_state *s, int fd) camel_object_unref((CamelObject *)s->stream); s->stream = NULL; } + s->ioerrno = 0; return 0; } else { + s->ioerrno = errno?errno:EIO; return -1; } } @@ -1547,8 +1566,10 @@ folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream) close(s->fd); s->fd = -1; } + s->ioerrno = 0; return 0; } else { + s->ioerrno = errno?errno:EIO; return -1; } } |