-/* $Cambridge: exim/src/src/transports/appendfile.c,v 1.27 2010/06/07 00:12:42 pdp Exp $ */
-
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
enum { mbf_unix, mbf_mbx, mbf_smail, mbf_maildir, mbf_mailstore };
-static char *mailbox_formats[] = {
+static const char *mailbox_formats[] = {
"unix", "mbx", "smail", "maildir", "mailstore" };
opt_public flag. */
optionlist appendfile_transport_options[] = {
+#ifdef SUPPORT_MAILDIR
+ { "*expand_maildir_use_size_file", opt_stringptr,
+ (void *)offsetof(appendfile_transport_options_block, expand_maildir_use_size_file) },
+#endif
{ "*set_use_fcntl_lock",opt_bool | opt_hidden,
(void *)offsetof(appendfile_transport_options_block, set_use_fcntl) },
{ "*set_use_flock_lock",opt_bool | opt_hidden,
(void *)offsetof(appendfile_transport_options_block, maildir_retries) },
{ "maildir_tag", opt_stringptr,
(void *)offsetof(appendfile_transport_options_block, maildir_tag) },
- { "maildir_use_size_file", opt_bool,
+ { "maildir_use_size_file", opt_expand_bool,
(void *)offsetof(appendfile_transport_options_block, maildir_use_size_file ) } ,
{ "maildirfolder_create_regex", opt_stringptr,
(void *)offsetof(appendfile_transport_options_block, maildirfolder_create_regex ) },
NULL, /* quota_warn_threshold */
NULL, /* mailbox_size_string */
NULL, /* mailbox_filecount_string */
+ NULL, /* expand_maildir_use_size_file */
US"^(?:cur|new|\\..*)$", /* maildir_dir_regex */
NULL, /* maildir_tag */
NULL, /* maildirfolder_create_regex */
uid = uid;
gid = gid;
+if (ob->expand_maildir_use_size_file)
+ ob->maildir_use_size_file = expand_check_condition(ob->expand_maildir_use_size_file,
+ US"`maildir_use_size_file` in transport", tblock->name);
+
/* Loop for quota, quota_filecount, quota_warn_threshold, mailbox_size,
mailbox_filecount */
"%s/maildirsize", check_path);
return FALSE;
}
- else if (maildirsize_fd == -2)
- {
- DEBUG(D_transport) debug_printf("disabling quota check because of "
- "races updating %s/maildirsize", check_path);
- disable_quota = TRUE;
- }
+ /* can also return -2, which means that the file was removed because of
+ raciness; but in this case, the size & filecount will still have been
+ updated. */
- if (maildirsize_fd >= 0)
- {
- if (mailbox_size < 0) mailbox_size = size;
- if (mailbox_filecount < 0) mailbox_filecount = filecount;
- }
+ if (mailbox_size < 0) mailbox_size = size;
+ if (mailbox_filecount < 0) mailbox_filecount = filecount;
}
/* No quota enforcement; ensure file does *not* exist; calculate size if
if (yield == OK && maildirsize_fd >= 0)
maildir_record_length(maildirsize_fd, message_size);
maildir_save_errno = errno; /* Preserve errno while closing the file */
- (void)close(maildirsize_fd);
+ if (maildirsize_fd >= 0)
+ (void)close(maildirsize_fd);
errno = maildir_save_errno;
}
#endif /* SUPPORT_MAILDIR */