mlmmj

changeset 179d5a0ed686

Better logging when moving requeue mailfiles into place
author Ben Schmidt
date Fri, 12 Nov 2010 00:01:07 +1100
parents 5bab557020a6
children 2add5c5f88f8
files ChangeLog src/mlmmj-send.c
diffstat 2 files changed, 17 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/ChangeLog	Mon Nov 01 08:31:08 2010 +1100
     1.2 +++ b/ChangeLog	Fri Nov 12 00:01:07 2010 +1100
     1.3 @@ -1,3 +1,4 @@
     1.4 + o Improved error logging when requeuing
     1.5   o Fix php-admin to work when topdir contains a symlink (e.g. on Mac)
     1.6   o Better techniques for locating support files in php-admin -- existing
     1.7     installations will need to have their conf/config.php altered to set
     2.1 --- a/src/mlmmj-send.c	Mon Nov 01 08:31:08 2010 +1100
     2.2 +++ b/src/mlmmj-send.c	Fri Nov 12 00:01:07 2010 +1100
     2.3 @@ -1303,10 +1303,23 @@
     2.4  		} else {
     2.5  			len = strlen(listdir) + 9 + 20 + 9;
     2.6  		  	requeuefilename = mymalloc(len);
     2.7 -		  	snprintf(requeuefilename, len, "%s/requeue/%d/mailfile", listdir,
     2.8 -				mindex);
     2.9 -			if (rename(mailfilename, requeuefilename) < 0)
    2.10 +			snprintf(requeuefilename, len, "%s/requeue/%d",
    2.11 +				listdir, mindex);
    2.12 +			if(stat(requeuefilename, &st) < 0) {
    2.13 +				/* Nothing was requeued and we don't keep
    2.14 +				 * mail for a noarchive list. */
    2.15  				unlink(mailfilename);
    2.16 +			} else {
    2.17 +				snprintf(requeuefilename, len,
    2.18 +					"%s/requeue/%d/mailfile",
    2.19 +					listdir, mindex);
    2.20 +				if (rename(mailfilename, requeuefilename) < 0) {
    2.21 +					log_error(LOG_ARGS,
    2.22 +							"Could not rename(%s,%s);",
    2.23 +							mailfilename,
    2.24 +							requeuefilename);
    2.25 +				}
    2.26 +			}
    2.27  			myfree(requeuefilename);
    2.28  		}
    2.29  		myfree(archivefilename);