[dovecot-cvs] dovecot/src/lib-storage/index index-save.c,1.19,1.20 index-sync.c,1.15,1.16

cras at procontrol.fi cras at procontrol.fi
Fri Oct 25 05:59:38 EEST 2002


Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv27981/lib-storage/index

Modified Files:
	index-save.c index-sync.c 
Log Message:
Error message fixes for APPEND. Make sure we don't crash if sync_callbacks
isn't set. Don't set sync_callbacks until SELECT is finished.



Index: index-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-save.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- index-save.c	21 Oct 2002 00:09:29 -0000	1.19
+++ index-save.c	25 Oct 2002 01:59:36 -0000	1.20
@@ -85,8 +85,14 @@
 	while (data_size > 0) {
 		ret = i_buffer_read(inbuf);
 		if (ret < 0) {
-			mail_storage_set_critical(storage,
-						  "Error reading mail: %m");
+			errno = inbuf->buf_errno;
+			if (errno == 0) {
+				mail_storage_set_error(storage,
+					"Client disconnected");
+			} else {
+				mail_storage_set_critical(storage,
+					"Error reading mail from client: %m");
+			}
 			return FALSE;
 		}
 
@@ -97,6 +103,7 @@
 		if (!failed) {
 			ret = write_func(outbuf, data, size);
 			if (ret < 0) {
+				errno = outbuf->buf_errno;
 				if (errno == ENOSPC) {
 					mail_storage_set_error(storage,
 						"Not enough disk space");

Index: index-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sync.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- index-sync.c	23 Oct 2002 17:03:39 -0000	1.15
+++ index-sync.c	25 Oct 2002 01:59:36 -0000	1.16
@@ -10,6 +10,9 @@
 {
 	unsigned int messages, recent;
 
+	if (ibox->sync_callbacks.new_messages == NULL)
+		return;
+
 	messages = ibox->index->get_header(ibox->index)->messages_count;
 	messages += mail_modifylog_get_expunge_count(ibox->index->modifylog);
 
@@ -39,7 +42,8 @@
 		}
 
 		/* notify client once about it */
-		if (!ibox->sent_diskspace_warning) {
+		if (!ibox->sent_diskspace_warning &&
+		    ibox->sync_callbacks.alert_no_diskspace != NULL) {
 			ibox->sent_diskspace_warning = TRUE;
 			ibox->sync_callbacks.alert_no_diskspace(
 						&ibox->box, ibox->sync_context);
@@ -56,7 +60,8 @@
 		index_storage_sync_size(ibox);
 
 	/* notify changes in custom flags */
-	if (mail_custom_flags_has_changes(index->custom_flags)) {
+	if (mail_custom_flags_has_changes(index->custom_flags) &&
+	    ibox->sync_callbacks.new_custom_flags != NULL) {
 		ibox->sync_callbacks.new_custom_flags(&ibox->box,
                 	mail_custom_flags_list_get(index->custom_flags),
 			MAIL_CUSTOM_FLAGS_COUNT, ibox->sync_context);




More information about the dovecot-cvs mailing list