looping over zero length file

Julian Field jkf at ecs.soton.ac.uk
Tue Jul 2 14:54:13 IST 2002


At 14:48 02/07/2002, you wrote:
>In /var/spool/mqueue.in, I have a single file:
>
>-rw-------   1 root     root            0 Jun  7 17:40 qfRAA06251
>
>Removing it solved the problem...
>
>Perhaps mailscanner should check to ensure that the file is non-zero
>length before attempting to parse it...

Good idea. If you are using a recent version, the patch looks like this.
Add 1 line (the "+" line) to sendmail.pl.

*** 132,141 ****
--- 132,142 ----
       # Optimised by binning the 50% that aren't H files first
       next unless $file =~ /$MTA::HFileRegexp/;
       $tmpdate = (stat("$InQueueDir/$file"))[9]; # 9 = mtime
       #next unless -f "$InQueueDir/$file";
       next unless -f _;
+     next if -z _; # Skip 0-length qf files
       $ModDate{$file} = $tmpdate;
     }
     @SortedFiles = sort { $ModDate{$a} <=> $ModDate{$b} } keys %ModDate;

     # Keep going until end of dir or have reached every imposed limit.

--
Julian Field                Teaching Systems Manager
jkf at ecs.soton.ac.uk         Dept. of Electronics & Computer Science
Tel. 023 8059 2817          University of Southampton
                             Southampton SO17 1BJ



More information about the MailScanner mailing list