]> git.donarmstrong.com Git - debbugs.git/commitdiff
close directory after reading from it
authorDon Armstrong <don@donarmstrong.com>
Tue, 24 Jul 2012 17:53:32 +0000 (10:53 -0700)
committerDon Armstrong <don@donarmstrong.com>
Tue, 24 Jul 2012 17:53:32 +0000 (10:53 -0700)
scripts/spamscan

index 9114b837439747b556b4ad9eede35218c8d72398..6d8918776639dbf5300603bea92169c1e45ccd37 100755 (executable)
@@ -259,10 +259,11 @@ for (;;) {
            last;
        }
         my @i;
-       opendir DIR, 'incoming' or die "opendir incoming: $!";
-       while (defined($_ = readdir DIR)) {
+       opendir my $dir, 'incoming' or die "opendir incoming: $!";
+       while (defined($_ = readdir $dir)) {
            push @i, $1 if /^S(.*)/;
        }
+       close $dir;
        unless (@i) {
            lprint "No more spam to process\n";
            last;