_mail->uid, &flags);
if (maildir_filename_get_size(fname, MAILDIR_EXTRA_VIRTUAL_SIZE,
&size)) {
- i_error("Maildir filename has wrong W value: %s/%s",
+ mail_storage_set_critical(_mail->box->storage,
+ "Maildir filename has wrong W value: %s/%s",
mbox->path, fname);
} else if (maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
MAILDIR_UIDLIST_REC_EXT_VSIZE) != NULL) {
static int maildir_transaction_fsync_dirs(struct maildir_save_context *ctx,
bool new_changed, bool cur_changed)
{
+ struct mail_storage *storage = &ctx->mbox->storage->storage;
+
if (ctx->mbox->ibox.fsync_disable)
return 0;
if (new_changed) {
if (fdatasync_path(ctx->newdir) < 0) {
- i_error("fdatasync_path(%s) failed: %m", ctx->newdir);
+ mail_storage_set_critical(storage,
+ "fdatasync_path(%s) failed: %m", ctx->newdir);
return -1;
}
}
if (cur_changed) {
if (fdatasync_path(ctx->curdir) < 0) {
- i_error("fdatasync_path(%s) failed: %m", ctx->curdir);
+ mail_storage_set_critical(storage,
+ "fdatasync_path(%s) failed: %m", ctx->curdir);
return -1;
}
}
"Mailbox was deleted while it was being created");
return -1;
} else {
- i_error("open(%s, O_CREAT) failed: %m", path);
+ mail_storage_set_critical(_storage,
+ "open(%s, O_CREAT) failed: %m", path);
}
return 0;
}
static void maildir_uidlist_close(struct maildir_uidlist *uidlist)
{
+ struct mail_storage *storage = uidlist->ibox->box.storage;
+
if (uidlist->fd != -1) {
- if (close(uidlist->fd) < 0)
- i_error("close(%s) failed: %m", uidlist->path);
+ if (close(uidlist->fd) < 0) {
+ mail_storage_set_critical(storage,
+ "close(%s) failed: %m", uidlist->path);
+ }
uidlist->fd = -1;
uidlist->fd_ino = 0;
}
i_stream_destroy(&input);
if (ret <= 0) {
- if (close(fd) < 0)
- i_error("close(%s) failed: %m", uidlist->path);
+ if (close(fd) < 0) {
+ mail_storage_set_critical(storage,
+ "close(%s) failed: %m", uidlist->path);
+ }
}
return ret;
}
if (mbox->mbox_fd != -1) {
if (close(mbox->mbox_fd) < 0)
- i_error("close(mbox) failed: %m");
+ mbox_set_syscall_error(mbox, "close()");
mbox->mbox_fd = -1;
}
}
orig_dir_fd = open(".", O_RDONLY);
if (orig_dir_fd == -1) {
- i_error("open(.) failed: %m");
+ mail_storage_set_critical(&mbox->storage->storage,
+ "open(.) failed: %m");
return -1;
}
} else {
dir = t_strdup_until(mbox->path, fname);
if (chdir(dir) < 0) {
- i_error("chdir(%s) failed: %m", dir);
+ mail_storage_set_critical(&mbox->storage->storage,
+ "chdir(%s) failed: %m", dir);
(void)close(orig_dir_fd);
return -1;
}
}
if (op == MBOX_DOTLOCK_OP_LOCK) {
if (access(fname, R_OK) < 0) {
- i_error("access(%s) failed: %m", mbox->path);
+ mail_storage_set_critical(&mbox->storage->storage,
+ "access(%s) failed: %m", mbox->path);
return -1;
}
}
restrict_access_drop_priv_gid();
- if (fchdir(orig_dir_fd) < 0)
- i_error("fchdir() failed: %m");
+ if (fchdir(orig_dir_fd) < 0) {
+ mail_storage_set_critical(&mbox->storage->storage,
+ "fchdir() failed: %m");
+ }
(void)close(orig_dir_fd);
return ret;
}
var_expand(location, storage->location, tab);
if (mail_storage_create(ns, NULL, str_c(location), _storage->flags,
_storage->lock_method, &error) < 0) {
- i_error("Namespace '%s': %s", ns->prefix, error);
+ mail_storage_set_critical(_storage, "Namespace '%s': %s",
+ ns->prefix, error);
return -1;
}
/* FIXME: we could remove namespaces here that don't have usable