dovecot-2.2: lib: istream_file.stat() fails, set stream_errno an...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 30 11:01:07 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/d4422b0560fe
changeset: 18895:d4422b0560fe
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 30 12:17:35 2015 +0300
description:
lib: istream_file.stat() fails, set stream_errno and error string.
For now we'll also keep logging the error since everybody isn't using
i_stream_get_error().

diffstat:

 src/lib/istream-file.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 5631687b52ef -r d4422b0560fe src/lib/istream-file.c
--- a/src/lib/istream-file.c	Tue Jun 30 11:26:47 2015 +0300
+++ b/src/lib/istream-file.c	Tue Jun 30 12:17:35 2015 +0300
@@ -161,12 +161,18 @@
 		/* return defaults */
 	} else if (stream->fd != -1) {
 		if (fstat(stream->fd, &stream->statbuf) < 0) {
-			i_error("file_istream.fstat(%s) failed: %m", name);
+			stream->istream.stream_errno = errno;
+			io_stream_set_error(&stream->iostream,
+				"file_istream.fstat(%s) failed: %m", name);
+			i_error("%s", i_stream_get_error(&stream->istream));
 			return -1;
 		}
 	} else {
 		if (stat(name, &stream->statbuf) < 0) {
-			i_error("file_istream.stat(%s) failed: %m", name);
+			stream->istream.stream_errno = errno;
+			io_stream_set_error(&stream->iostream,
+				"file_istream.stat(%s) failed: %m", name);
+			i_error("%s", i_stream_get_error(&stream->istream));
 			return -1;
 		}
 	}


More information about the dovecot-cvs mailing list