}
mail->to = addr;
res = send_mail(sockfd, mail, listfd, ctrlfd, bounceaddr != NULL);
- free(bounceaddr);
+ if (bounceaddr != NULL) {
+ free(bounceaddr);
+ mail->from = NULL;
+ }
if(res && listaddr && archivefilename) {
/* we failed, so save the addresses and bail */
index = get_index_from_filename(archivefilename);
if ((mailfd = open(mailfilename, O_RDWR)) == -1 ||
!lock(mailfd, true)) {
- log_error(LOG_ARGS, "Could not open '%s'", mailfilename);
- exit(EXIT_FAILURE);
+ if (ml.dir != NULL && mailfd == -1) {
+ if ((mailfd = openat(ml.fd, mailfilename, O_RDWR)) == -1 ||
+ !lock(mailfd, true)) {
+ log_error(LOG_ARGS, "Could not open '%s'", mailfilename);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ log_error(LOG_ARGS, "Could not open '%s'", mailfilename);
+ exit(EXIT_FAILURE);
+ }
}
mail.fp = fdopen(mailfd, "r");