[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.61, 1.62

cras at dovecot.org cras at dovecot.org
Mon Aug 23 22:04:54 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv19241

Modified Files:
	mbox-save.c 
Log Message:
Use correct error messages.



Index: mbox-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- mbox-save.c	22 Aug 2004 11:59:23 -0000	1.61
+++ mbox-save.c	23 Aug 2004 19:04:52 -0000	1.62
@@ -49,13 +49,14 @@
 
 static char my_hostdomain[256] = "";
 
-static void write_error(struct mbox_save_context *ctx)
+static void write_error(struct mbox_save_context *ctx, int error)
 {
-	if (ENOSPACE(errno)) {
+	if (ENOSPACE(error)) {
 		mail_storage_set_error(ctx->ibox->box.storage,
 				       "Not enough disk space");
 	} else {
-                mbox_set_syscall_error(ctx->ibox, "write()");
+		errno = error;
+		mbox_set_syscall_error(ctx->ibox, "write()");
 	}
 }
 
@@ -81,7 +82,7 @@
 
 	if (ch != '\n') {
 		if (write_full(fd, "\n", 1) < 0) {
-			write_error(ctx);
+			write_error(ctx, errno);
 			return -1;
 		}
 		*offset += 1;
@@ -93,7 +94,7 @@
 static int mbox_append_lf(struct mbox_save_context *ctx)
 {
 	if (o_stream_send(ctx->output, "\n", 1) < 0) {
-		write_error(ctx);
+		write_error(ctx, ctx->output->stream_errno);
 		return -1;
 	}
 
@@ -130,7 +131,7 @@
 	line = mbox_from_create(from_envelope, received_date);
 
 	if ((ret = o_stream_send_str(ctx->output, line)) < 0)
-		write_error(ctx);
+		write_error(ctx, ctx->output->stream_errno);
 	t_pop();
 
 	return ret;
@@ -156,7 +157,7 @@
 		mbox_set_syscall_error(ctx->ibox, "o_stream_seek()");
 		ret = -1;
 	} else if (o_stream_send(ctx->output, str, len) < 0) {
-		write_error(ctx);
+		write_error(ctx, ctx->output->stream_errno);
 		ret = -1;
 	} else {
 		if (o_stream_seek(ctx->output, end_offset) < 0) {



More information about the dovecot-cvs mailing list