From: Frédéric Marchal Date: Wed, 14 Mar 2012 06:41:24 +0000 (+0100) Subject: Don't process the download report if no entry was written in the log file X-Git-Tag: v2.3.3-pre1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5589b8470f1c7d2f102dbd0f5fab23a115767c04;p=thirdparty%2Fsarg.git Don't process the download report if no entry was written in the log file If the download.int_unsort file doesn't exist, the sort command fails and sarg abort the process. With this patch, it simply continues the processing optionaly printing an information message. Now, it is an error if the sorted file doesn't exists. In previous versions, it was just a warning. --- diff --git a/download.c b/download.c index b1fd04c..83b4191 100644 --- a/download.c +++ b/download.c @@ -110,6 +110,11 @@ void download_report(void) struct userinfostruct *uinfo; struct tm t; + if (!ndownload) { + if (debugz) debugaz(_("No downloaded files to report\n")); + return; + } + ouser[0]='\0'; ouser2[0]='\0'; @@ -117,8 +122,8 @@ void download_report(void) snprintf(report_in,sizeof(report_in),"%s/download.int_log",tmp); download_sort(report_in); if(access(report_in, R_OK) != 0) { - if (debugz) debugaz(_("Downloaded files report not generated as it is empty\n")); - return; + debugaz(_("Sorted file doesn't exist (to produce the download report)\n")); + exit(EXIT_FAILURE); } // produce the report.