--- clamd.orig 2007-03-05 17:03:48.000000000 -0800 +++ clamd 2007-03-05 17:02:45.000000000 -0800 @@ -45,6 +45,25 @@ chown ${clamav_user} ${logfile} fi + if [[ ${MILTER_OPTS} == *--external* ]]; then + local clamd_socket_wait_count=0 + local clamd_socket_wait_max=10 + local clamd_socket_wait_result=-1 + ebegin "Waiting for clamd to create ${clamd_socket}" + while [[ clamd_socket_wait < clamd_socket_wait_max ]]; do + if [ -S "${clamd_socket:-/tmp/clamd}" ]; then + clamd_socket_wait_result=0 + break + else + echo -n " ." + let clamd_socket_wait++ + sleep 1 + fi + done + echo + eend $clamd_socket_wait_result "Timeout waiting for ${clamd_socket}" + fi + ebegin "Starting clamav-milter" start-stop-daemon --start --quiet \ --exec /usr/sbin/clamav-milter -- ${MILTER_OPTS} ${MILTER_SOCKET}