#include "lib.h"
#include "ioloop.h"
#include "istream.h"
+#include "ostream.h"
#include "restrict-access.h"
#include "master-service.h"
#include "mailbox-list-private.h"
static MODULE_CONTEXT_DEFINE_INIT(mbox_mailbox_list_module,
&mailbox_list_module_register);
-void mbox_set_syscall_error(struct mbox_mailbox *mbox, const char *function)
+static void
+mbox_set_syscall_error_str(struct mbox_mailbox *mbox, const char *function,
+ const char *error)
{
i_assert(function != NULL);
} else {
const char *toobig_error = errno != EFBIG ? "" :
" (process was started with ulimit -f limit)";
- mailbox_set_critical(&mbox->box,
- "%s failed with mbox: %m%s", function, toobig_error);
+ mailbox_set_critical(&mbox->box, "%s failed with mbox: %s%s",
+ function, error, toobig_error);
}
}
+void mbox_set_syscall_error(struct mbox_mailbox *mbox, const char *function)
+{
+ mbox_set_syscall_error_str(mbox, function, strerror(errno));
+}
+
+void mbox_istream_set_syscall_error(struct mbox_mailbox *mbox,
+ struct istream *input,
+ const char *function)
+{
+ errno = input->stream_errno;
+ mbox_set_syscall_error_str(mbox, function, i_stream_get_error(input));
+}
+
+void mbox_ostream_set_syscall_error(struct mbox_mailbox *mbox,
+ struct ostream *output,
+ const char *function)
+{
+ errno = output->stream_errno;
+ mbox_set_syscall_error_str(mbox, function, o_stream_get_error(output));
+}
+
static int
mbox_list_get_path(struct mailbox_list *list, const char *name,
enum mailbox_list_path_type type, const char **path_r)
extern unsigned int mbox_hide_headers_count, mbox_save_drop_headers_count;
void mbox_set_syscall_error(struct mbox_mailbox *mbox, const char *function);
+void mbox_istream_set_syscall_error(struct mbox_mailbox *mbox,
+ struct istream *input,
+ const char *function);
+void mbox_ostream_set_syscall_error(struct mbox_mailbox *mbox,
+ struct ostream *output,
+ const char *function);
struct mailbox_sync_context *
mbox_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);