Mercurial > dovecot > core-2.2
changeset 18895:d4422b0560fe
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().
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 30 Jun 2015 12:17:35 +0300 |
parents | 5631687b52ef |
children | ac64c307d179 |
files | src/lib/istream-file.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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; } }