From: Timo Sirainen Date: Mon, 28 Jun 2010 20:34:45 +0000 (+0100) Subject: lib-storage: Use mail->saving, not mail->uid==0 to check if mail is being saved. X-Git-Tag: 2.0.rc1~68 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3eb63515855f386449c22233d1f1baf1ddfe8a2d;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Use mail->saving, not mail->uid==0 to check if mail is being saved. The uid may be non-zero when saving with dsync. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index e33b1bc081..24de5bb1eb 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -1320,7 +1320,7 @@ void index_mail_set_seq(struct mail *_mail, uint32_t seq) /* open the stream only if we didn't get here from mailbox_save_init() */ hdr = mail_index_get_header(_mail->box->view); - if (_mail->uid != 0 && _mail->uid < hdr->next_uid) + if (!_mail->saving && _mail->uid < hdr->next_uid) (void)mail_get_stream(_mail, NULL, NULL, &input); } } diff --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index 97098e9d2e..faf6b09f0e 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -118,7 +118,7 @@ static int maildir_mail_stat(struct mail *mail, struct stat *st) if (stp == NULL) return -1; *st = *stp; - } else if (mail->uid != 0) { + } else if (!mail->saving) { imail->mail.stats_stat_lookup_count++; ret = maildir_file_do(mbox, mail->uid, do_stat, st); if (ret <= 0) { @@ -274,7 +274,7 @@ static int maildir_quick_size_lookup(struct index_mail *mail, bool vsize, enum maildir_uidlist_rec_ext_key key; const char *path, *fname, *value; - if (_mail->uid != 0) { + if (!_mail->saving) { if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0) return -1; } else { @@ -292,7 +292,7 @@ static int maildir_quick_size_lookup(struct index_mail *mail, bool vsize, return 1; /* size can be included in uidlist entry */ - if (_mail->uid != 0) { + if (!_mail->saving) { key = vsize ? MAILDIR_UIDLIST_REC_EXT_VSIZE : MAILDIR_UIDLIST_REC_EXT_PSIZE; value = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid, @@ -411,7 +411,7 @@ static int maildir_mail_get_physical_size(struct mail *_mail, uoff_t *size_r) return 0; } - if (_mail->uid != 0) { + if (!_mail->saving) { ret = maildir_file_do(mbox, _mail->uid, do_stat, &st); if (ret <= 0) { if (ret == 0) @@ -450,7 +450,7 @@ maildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field, *value_r = mail->data.guid; return 0; } - if (_mail->uid != 0) { + if (!_mail->saving) { if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0) return -1; } else { diff --git a/src/plugins/zlib/zlib-plugin.c b/src/plugins/zlib/zlib-plugin.c index af80dc44ac..5cd2a48fe5 100644 --- a/src/plugins/zlib/zlib-plugin.c +++ b/src/plugins/zlib/zlib-plugin.c @@ -143,7 +143,7 @@ static int zlib_permail_get_stream(struct mail *_mail, in such situation we're probably checking if the user-given input looks compressed */ if (imail->data.stream != NULL || - (_mail->uid == 0 && zuser->save_handler == NULL)) { + (_mail->saving && zuser->save_handler == NULL)) { return zmail->super.get_stream(_mail, hdr_size, body_size, stream_r); }