]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Maildir: Use i_stream_stat() instead of i_stream_get_fd()+fstat(). Fixes zlib plugin.
authorTimo Sirainen <tss@iki.fi>
Sun, 31 May 2009 23:29:53 +0000 (19:29 -0400)
committerTimo Sirainen <tss@iki.fi>
Sun, 31 May 2009 23:29:53 +0000 (19:29 -0400)
--HG--
branch : HEAD

src/lib-storage/index/maildir/maildir-mail.c

index 4fa3937e13184663187333e9d5c0c9f0faad401c..ab498b9062886e232cec209647be10955ad8cc12 100644 (file)
@@ -72,8 +72,9 @@ static int maildir_mail_stat(struct mail *mail, struct stat *st)
 {
        struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->box;
        struct index_mail *imail = (struct index_mail *)mail;
+       const struct stat *stp;
        const char *path;
-       int fd, ret;
+       int ret;
 
        if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE)
                return mail_set_aborted(mail);
@@ -86,15 +87,11 @@ static int maildir_mail_stat(struct mail *mail, struct stat *st)
        }
 
        if (imail->data.stream != NULL) {
-               fd = i_stream_get_fd(imail->data.stream);
-               i_assert(fd != -1);
-
                imail->mail.stats_fstat_lookup_count++;
-               if (fstat(fd, st) < 0) {
-                       mail_storage_set_critical(&mbox->storage->storage,
-                                                 "fstat(maildir) failed: %m");
+               stp = i_stream_stat(imail->data.stream, FALSE);
+               if (stp == NULL)
                        return -1;
-               }
+               *st = *stp;
        } else if (mail->uid != 0) {
                imail->mail.stats_stat_lookup_count++;
                ret = maildir_file_do(mbox, mail->uid, do_stat, st);