--- mimedefang.pl.ori	2007-05-15 16:51:37.000000000 -0400
+++ mimedefang.pl	2007-05-16 00:09:50.000000000 -0400
@@ -1299,8 +1299,15 @@
 	$counter++;
 	$QuarantineSubdir = sprintf("%s/qdir-%s-%03d",
 				    $Features{'Path:QUARANTINEDIR'}, $tm, $counter);
-	if (mkdir($QuarantineSubdir, 0750)) {
-	    $success = 1;
+	if( ! -d $QuarantineSubdir ) {
+		# the directory does not exists, try only once to create it
+		if (mkdir($QuarantineSubdir, 0750)) {
+			$success = 1;
+		}
+		else {
+			# can't create the directory
+			$tries = 1000;
+		}
 	}
     } while(!$success && ($tries++ < 1000));
     if (!$success) {
