]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream_file.stat() fails, set stream_errno and error string.
authorTimo Sirainen <tss@iki.fi>
Tue, 30 Jun 2015 09:17:35 +0000 (12:17 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 30 Jun 2015 09:17:35 +0000 (12:17 +0300)
For now we'll also keep logging the error since everybody isn't using
i_stream_get_error().

src/lib/istream-file.c

index 8d1c0b9a34749b5efb5eb37920171b2073de1b60..4df72f04a6d33660c4f03599fa65940f693adeff 100644 (file)
@@ -161,12 +161,18 @@ i_stream_file_stat(struct istream_private *stream, bool exact ATTR_UNUSED)
                /* 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;
                }
        }