Very important !!: If CLamAntivirus and Qmail-Scanner run as different users, there is a tmp where qmail-scanner puts the attachments, and Clamantivirus checks them. That directory is /var/spool/qmailscan/tmp/ (WHICH BY DEFAULT IS OWNED BY QMAIL-SCANNER USER AND 700 PERMISIONS, CLAMAV BEING UNABLE TO CHECK IT).

THE SOLUTION IS FOR clamdscan: corrupt or unknown clamd scanner error or memory/resource/perms problem - exit status 512/2 error!!QMAIL-SCANNER PUTS THE ATTACHMENTS IN /var/spool/qmailscan/tmp and clamav need at least read permissions on this directory so it will be able to scan the attachments.