dovecot-1.1: Maildir: Use i_stream_stat() instead of i_stream_ge...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 1 02:32:59 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/140bd7523890
changeset: 8295:140bd7523890
user:      Timo Sirainen <tss at iki.fi>
date:      Sun May 31 19:32:54 2009 -0400
description:
Maildir: Use i_stream_stat() instead of i_stream_get_fd()+fstat(). Fixes zlib plugin.

diffstat:

1 file changed, 6 insertions(+), 9 deletions(-)
src/lib-storage/index/maildir/maildir-mail.c |   15 ++++++---------

diffs (33 lines):

diff -r e596c98605dd -r 140bd7523890 src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c	Tue May 26 16:31:42 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Sun May 31 19:32:54 2009 -0400
@@ -70,8 +70,9 @@ static int maildir_mail_stat(struct mail
 {
 	struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->box;
 	struct index_mail_data *data = &((struct index_mail *)mail)->data;
+	const struct stat *stp;
 	const char *path;
-	int fd, ret;
+	int ret;
 
 	if (data->access_part != 0 && data->stream == NULL) {
 		/* we're going to open the mail anyway */
@@ -81,14 +82,10 @@ static int maildir_mail_stat(struct mail
 	}
 
 	if (data->stream != NULL) {
-		fd = i_stream_get_fd(data->stream);
-		i_assert(fd != -1);
-
-		if (fstat(fd, st) < 0) {
-			mail_storage_set_critical(&mbox->storage->storage,
-						  "fstat(maildir) failed: %m");
-			return -1;
-		}
+		stp = i_stream_stat(data->stream, FALSE);
+		if (stp == NULL)
+			return -1;
+		*st = *stp;
 	} else if (mail->uid != 0) {
 		ret = maildir_file_do(mbox, mail->uid, do_stat, st);
 		if (ret <= 0) {


More information about the dovecot-cvs mailing list