Browse code

make script more perl like

git-svn: trunk@4032

Török Edvin authored on 2008/07/30 23:03:51
Showing 1 changed files
... ...
@@ -2,22 +2,20 @@
2 2
 
3 3
 # ---- Settings ----
4 4
 # TemporaryDirectory in clamd.conf
5
-my($TMPDIR)='/tmp';
5
+my $TMPDIR='/tmp';
6 6
 # How long to wait for next part of RFC1341 message (seconds)
7
-my($cleanup_interval)=3600;
7
+my $cleanup_interval=3600;
8 8
 
9 9
 # ---- End of Settings ----
10 10
 
11
-my ($partial_dir) = "$TMPDIR/clamav-partial";
11
+my $partial_dir = "$TMPDIR/clamav-partial";
12 12
 #  if there is no partial directory, nothing to clean up
13 13
 opendir(DIR, $partial_dir) || exit 0;
14 14
 
15
-my ($cleanup_threshold) = time - $cleanup_interval;
15
+my $cleanup_threshold = time - $cleanup_interval;
16 16
 while(my $file = readdir(DIR)) {
17 17
 	next unless $file =~ m/^clamav-partial-([0-9]+)_[0-9a-f]{32}-[0-9]+$/;
18 18
 	my $filetime = $1;
19
-	if ($filetime <= $cleanup_threshold) {
20
-		unlink "$partial_dir/$file";
21
-	}
19
+	unlink "$partial_dir/$file" unless $filetime > $cleanup_threshold;
22 20
 }
23 21
 closedir DIR;