changeset 321:636e9c51320d

Fixed requeueing
author mortenp
date Thu, 09 Sep 2004 07:22:17 +1000
parents b2fe9c6cb9fe
children b06e4673bbcf
files ChangeLog src/mlmmj-send.c
diffstat 2 files changed, 25 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 07 21:49:11 2004 +1000
+++ b/ChangeLog	Thu Sep 09 07:22:17 2004 +1000
@@ -1,3 +1,4 @@
+ o Fix dumping of addresses to requeue
  o Make the time an address can bounce before unsubscribed configurable with
    listdir/control/bouncelife
  o Correct mlmmj-make-ml.sh cronentry line to include -F
--- a/src/mlmmj-send.c	Tue Sep 07 21:49:11 2004 +1000
+++ b/src/mlmmj-send.c	Thu Sep 09 07:22:17 2004 +1000
@@ -399,23 +399,34 @@
 			addrfd = open(addrfilename, O_WRONLY|O_CREAT|O_APPEND,
 							S_IRUSR|S_IWUSR);
 			if(addrfd < 0) {
-				log_error(LOG_ARGS, "Could not write to %s",
+				log_error(LOG_ARGS, "Could not open %s",
 						    addrfilename);
 				myfree(addrfilename);
 				myfree(addr);
 				return -1;
-			} else { /* dump the remaining addresses */
-				do {
+			} else {
+				/* Dump the remaining addresses. We dump the
+				 * remaining before we write the failing
+				 * address to ensure the potential good ones
+				 * will be tried first when mlmmj-maintd
+				 * sends out mails that have been requeued. */
+				if(writen(addrfd, cur, start+st.st_size-cur)
+						< 0) {
+					log_error(LOG_ARGS, "Could not dump "
+							"remaining addresses "
+							"of subfile to "
+							"requeue address "
+							"file");
+				}
 					/* Dirty hack to add newline. */
-					len = strlen(addr);
-					if(writen(addrfd, addr, len) < 0)
-						log_error(LOG_ARGS,
-							"Could not add [%s] "
-							"to requeue address "
-							"file.", addr);
-					myfree(addr);
-					addr = mygetline(subfd);
-				} while(addr);
+				addr[len] = '\n';
+				if(writen(addrfd, addr, len+1) < 0) {
+					addr[len] = '\0';
+					log_error(LOG_ARGS, "Could not add "
+							"[%s] to requeue "
+							"address file", addr);
+				}
+				
 			}
 			
 			myfree(addr);