Random Project

race condition patch

If an email is delivered between ‘find’ seeing it and stating it, you get messy output. find has the ‘-ignore_readdir_race’ switch to address this.

@@ -132,10 +132,10 @@
done

# Get values
-deferred=`(test -d deferred && find deferred -type f ) | wc -l`
-active=`(test -d active && find active -type f ) | wc -l`
-corrupt=`(test -d corrupt && find corrupt -type f ) | wc -l`
-hold=`( test -d hold && find hold -type f ) | wc -l`
+deferred=`(test -d deferred && find deferred -ignore_readdir_race -type f ) | wc -l`
+active=`(test -d active && find active -ignore_readdir_race -type f ) | wc -l`
+corrupt=`(test -d corrupt && find corrupt -ignore_readdir_race -type f ) | wc -l`
+hold=`( test -d hold && find hold -ignore_readdir_race -type f ) | wc -l`
bounced=`cat /var/log/maillog | grep bounced | wc -l`
}