dovecot-2.2: istreams: When reading invalid data, fail with EINV...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 10 06:51:22 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/51a9846bb2bd
changeset: 14844:51a9846bb2bd
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 10 06:03:11 2012 +0300
description:
istreams: When reading invalid data, fail with EINVAL instead of EIO.
EINVAL was already used more.

diffstat:

 src/lib-mail/istream-attachment-extractor.c |  4 ++--
 src/lib-storage/index/istream-mail.c        |  2 +-
 src/lib/istream-sized.c                     |  2 +-
 src/lib/istream-sized.h                     |  2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r f31916c173d1 -r 51a9846bb2bd src/lib-mail/istream-attachment-extractor.c
--- a/src/lib-mail/istream-attachment-extractor.c	Fri Aug 10 05:55:13 2012 +0300
+++ b/src/lib-mail/istream-attachment-extractor.c	Fri Aug 10 06:03:11 2012 +0300
@@ -575,7 +575,7 @@
 		stream->istream.stream_errno = stream->parent->stream_errno;
 
 		if (ret < 0)
-			stream->istream.stream_errno = EIO;
+			stream->istream.stream_errno = EINVAL;
 		astream->cur_part = NULL;
 		return -1;
 	case 0:
@@ -588,7 +588,7 @@
 	if (block.part != astream->cur_part && astream->cur_part != NULL) {
 		/* end of a MIME part */
 		if (astream_end_of_part(astream) < 0) {
-			stream->istream.stream_errno = EIO;
+			stream->istream.stream_errno = EINVAL;
 			return -1;
 		}
 	}
diff -r f31916c173d1 -r 51a9846bb2bd src/lib-storage/index/istream-mail.c
--- a/src/lib-storage/index/istream-mail.c	Fri Aug 10 05:55:13 2012 +0300
+++ b/src/lib-storage/index/istream-mail.c	Fri Aug 10 06:03:11 2012 +0300
@@ -51,7 +51,7 @@
 		"(%"PRIuUOFF_T" %c %"PRIuUOFF_T")", str,
 		mstream->expected_size, chr, cur_size);
 	mail_set_cache_corrupted(mstream->mail, MAIL_FETCH_PHYSICAL_SIZE);
-	mstream->istream.istream.stream_errno = EIO;
+	mstream->istream.istream.stream_errno = EINVAL;
 }
 
 static ssize_t
diff -r f31916c173d1 -r 51a9846bb2bd src/lib/istream-sized.c
--- a/src/lib/istream-sized.c	Fri Aug 10 05:55:13 2012 +0300
+++ b/src/lib/istream-sized.c	Fri Aug 10 06:03:11 2012 +0300
@@ -59,7 +59,7 @@
 			"(%"PRIuUOFF_T" < %"PRIuUOFF_T")",
 			i_stream_get_name(stream->parent),
 			stream->istream.v_offset, sstream->size);
-		stream->istream.stream_errno = EIO;
+		stream->istream.stream_errno = EINVAL;
 	}
 
 	ret = pos > stream->pos ? (ssize_t)(pos - stream->pos) :
diff -r f31916c173d1 -r 51a9846bb2bd src/lib/istream-sized.h
--- a/src/lib/istream-sized.h	Fri Aug 10 05:55:13 2012 +0300
+++ b/src/lib/istream-sized.h	Fri Aug 10 06:03:11 2012 +0300
@@ -2,7 +2,7 @@
 #define ISTREAM_SIZED_H
 
 /* Assume that input is exactly the given size. If it's smaller, log an error
-   and fail with EIO error. If it's larger, log an error but don't fail. */
+   and fail with EINVAL error. If it's larger, log an error but don't fail. */
 struct istream *i_stream_create_sized(struct istream *input, uoff_t size);
 
 #endif


More information about the dovecot-cvs mailing list