openbsd-ports/mail/mailscanner/patches/patch-lib_clamav-wrapper
brad f23e3e75b6 Lift some temp file fixes from the github repo. It's always fun noticing your
mail server blow up so to speak and then wonder why /var is out of inodes and
seeing that 803,000 or so inodes are in use. Where could they posibly be in
use? Then finding 801,000+ 0 byte temp files which had been accumulating for
quite awhile in /var/spool/MailScanner/incoming/SpamAssassin-Temp.

ok sthen@
2013-12-12 21:56:19 +00:00

57 lines
2.1 KiB
Plaintext

$OpenBSD: patch-lib_clamav-wrapper,v 1.4 2013/12/12 21:56:19 brad Exp $
--- lib/clamav-wrapper.orig Sat Aug 20 08:32:02 2011
+++ lib/clamav-wrapper Wed Dec 11 18:30:49 2013
@@ -52,7 +52,6 @@
# You may want to check this script for bash-isms
#TempDir="/tmp/clamav.$$"
-TempDir=$(mktemp) || { echo "$0: Cannot make name for temporary dir" >&2; exit 1; }
ClamUser="clamav"
ClamGroup="clamav"
@@ -99,23 +98,23 @@ ExtraScanOptions=""
# LESS COMMON unpackers, which probably aren't installed by default
# (hence disabled)
# Uncomment ONE of the following lines if you have unrar installed
-#ExtraScanOptions="$ExtraScanOptions --unrar"
+ExtraScanOptions="$ExtraScanOptions --unrar"
#ExtraScanOptions="$ExtraScanOptions --unrar=/path/to/unrar"
# Uncomment ONE of the following lines if you have unarj installed
-#ExtraScanOptions="$ExtraScanOptions --unarj"
+ExtraScanOptions="$ExtraScanOptions --unarj"
#ExtraScanOptions="$ExtraScanOptions --unarj=/path/to/unarj"
# Uncomment ONE of the following lines if you have unace installed
-#ExtraScanOptions="$ExtraScanOptions --unace"
+ExtraScanOptions="$ExtraScanOptions --unace"
#ExtraScanOptions="$ExtraScanOptions --unace=/path/to/unace"
# Uncomment ONE of the following lines if you have lha installed
-#ExtraScanOptions="$ExtraScanOptions --lha"
+ExtraScanOptions="$ExtraScanOptions --lha"
#ExtraScanOptions="$ExtraScanOptions --lha=/path/to/lha"
# Uncomment ONE of the following lines if you have zoo installed
-#ExtraScanOptions="$ExtraScanOptions --zoo"
+ExtraScanOptions="$ExtraScanOptions --zoo"
#ExtraScanOptions="$ExtraScanOptions --zoo=/path/to/unzoo"
# Now increase the allowed expansion size of zip files
@@ -140,14 +139,10 @@ fi
PATH=$PATH:/usr/ucb
export PATH
-# Check if the tmpdir exists, if so delete so we start with a clean slate
-if [ -x "${TempDir}" ]; then
- rm -rf ${TempDir} >/dev/null 2>&1
-fi
# Make the Temp dir
umask 0077
-mkdir "${TempDir}" >/dev/null 2>&1
+TempDir=$(mktemp -d) || { echo "$0: Cannot create temporary dir" >&2; exit 1; }
# In case we get interupted....
trap "rm -rf ${TempDir}" EXIT