How about something like the attached?  This gives a permanent error if
the account is over quota, and temporary error otherwise.  I would
consider the case where a disk is out of space a temporary condition (I
know I wouldn't want to have mail lost in that case).

The patch also allows for more precise checks (and errnos) to be done in
the future for delivery.





-- 
Andres Salomon <[EMAIL PROTECTED]>
Revision: maildrop--delivery-errors--0--patch-1
Archive: [EMAIL PROTECTED]
Creator: Andres Salomon <[EMAIL PROTECTED]>
Date: Thu Jan 27 15:05:19 EST 2005
Standard-date: 2005-01-27 20:05:19 GMT
Modified-files: maildrop/deliver.C maildrop/maildir.C
New-patches: [EMAIL PROTECTED]/maildrop--delivery-errors--0--patch-1
Summary: default to returning a temporary error if unable to open maildir
Keywords: 

If opening a maildir fails, do not return a permanent error; we want the
message to be queued, and a delivery attempt made.  The current exception
is in the case of a mailbox being over quota; in that case, return a
permanent error.


--- orig/maildrop/deliver.C
+++ mod/maildrop/deliver.C
@@ -149,10 +149,12 @@
 	{
 	Maildir	deliver_maildir;
 	Mio	deliver_file;
+	int	err;
 
-		if ( deliver_maildir.MaildirOpen(mailbox, deliver_file,
-			maildrop.msgptr->MessageSize()) < 0)
-			throw 77;
+		err = deliver_maildir.MaildirOpen(mailbox, deliver_file,
+			maildrop.msgptr->MessageSize());
+		if (err < 0)
+			throw (-err);
 
 		format_mbox.Init(0);
 		if (format_mbox.DeliverTo(deliver_file))


--- orig/maildrop/maildir.C
+++ mod/maildrop/maildir.C
@@ -155,7 +155,8 @@
 				is_open=0;
 				maildir_deliver_quota_warning(dir, quota_warn_percent);
 				merr << "maildrop: maildir over quota.\n";
-				return (-1);
+				// this is a permanent error
+				return (-77);
 			}
 
 			maildir_quota_add_end(&quotainfo, s, 1);
@@ -167,14 +168,16 @@
 		{
 			merr << "maildrop: " << dir << ": " << strerror(errno)
 			     << "\n";
-			return -1;
+			// assume a temporary condition; add additional checks
+			// for other permanent errors, if necessary.
+			return -75;
 		}
 
 		AlarmSleep	try_again(2);
 	}
 
 	merr << "maildrop: time out on maildir directory.\n";
-	return (-1);
+	return (-75);
 }
 
 void	Maildir::MaildirSave()



Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to