changeset 427:df8e1e2f0ff6

Don't send the rest of the batch inside the while() loop
author mmj
date Tue, 18 Jan 2005 10:47:16 +1100
parents 4b2488be8710
children 09082b117b1a
files src/mlmmj-send.c
diffstat 1 files changed, 34 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/mlmmj-send.c	Mon Jan 17 05:43:48 2005 +1100
+++ b/src/mlmmj-send.c	Tue Jan 18 10:47:16 2005 +1100
@@ -1053,27 +1053,27 @@
 					stl.count = 0;
 				}
 			} while(res > 0);
+			myfree(subfilename);
+			close(subfd);
+
+		}
 			if(stl.count) {
 				initsmtp(&sockfd, relay);
 				if(verp) {
-					sendres = send_mail_verp(sockfd,
-							&stl, mailmap,
-							st.st_size,
-							verpfrom,
-							listdir, hdrs, hdrslen,
-							body, bodylen, verp);
+				sendres = send_mail_verp(sockfd, &stl, mailmap,
+						st.st_size, verpfrom, listdir,
+						hdrs, hdrslen, body, bodylen,
+						verp);
 					if(sendres)
-						requeuemail(listdir, strindex,
-								&stl, 0);
+					requeuemail(listdir, strindex, &stl,
+							0);
 				} else {
-					sendres = send_mail_many_list(sockfd,
-							NULL, NULL, mailmap,
-							st.st_size, &stl,
-							listaddr,
-							archivefilename,
-							listdir, mlmmjbounce,
-							hdrs, hdrslen, body,
-							bodylen);
+				sendres = send_mail_many_list(sockfd, NULL,
+						NULL, mailmap, st.st_size,
+						&stl, listaddr,
+						archivefilename, listdir,
+						mlmmjbounce, hdrs, hdrslen,
+						body, bodylen);
 				}
 				endsmtp(&sockfd);
 				for(i = 0; i < stl.count; i++)
@@ -1081,11 +1081,6 @@
 				stl.count = 0;
 			}
 
-			myfree(verpfrom);
-			myfree(subfilename);
-			myfree(stl.strs);
-			close(subfd);
-
 			if (sendres) {
 				/* If send_mail_many() failed we close the
 				 * connection to the mail server in a brutal
@@ -1095,7 +1090,8 @@
 			} else {
 				endsmtp(&sockfd);
 			}
-		}
+		myfree(stl.strs);
+		myfree(verpfrom);
 		closedir(subddir);
 		myfree(subddirname);
 		break;