Re: [Clamav-devel] Patch to fix broken sendfile on Linux 2.6

2006-01-16 Thread Nigel Horne

imacat wrote:

Hi,

I'm imacat from Taiwan.  Has this issue been taken care by someone?
I'm experiencing this same problem with my Linux 2.6.  But I did not see
this issue solved in the just-released ClamAV 0.88.


The patch was included in CVS sometime ago. It was an oversight that it
was not included within 0.88.
___
http://lurker.clamav.net/list/clamav-devel.html


Re: [Clamav-devel] Patch to fix broken sendfile on Linux 2.6

2006-01-15 Thread imacat
Hi,

I'm imacat from Taiwan.  Has this issue been taken care by someone?
I'm experiencing this same problem with my Linux 2.6.  But I did not see
this issue solved in the just-released ClamAV 0.88.

I set TemporaryDirectory to /dev/shm (virtual memory file system) so
that the scan can be faster.  But space in /dev/shm is very limited. 
While ClamAV cannot move found viruses to the quarantine directory,
/dev/shm get full in 1 week and no new mail can come in anymore.

Now I patched ClamAV in order to work properly.  Will it be solved
in the future version of ClamAV?

By the way, I have not found a clue on Google for a broken sendfile()
on Linux 2.6.  But it seems to be true that sendfile() is good on Linux
2.4 but not on Linux 2.6, after some simple tests myself.  Can anyone
point out to me where to find more information on this?  Thank you.

On Thu, 15 Dec 2005, Landy Roman [EMAIL PROTECTED] wrote:
 On Wednesday 14 December 2005 7:52 am, Nigel Horne wrote:  
   
  No attachment received, but I will look into it and provide a fix if  
  needed for myself.  
  
 According to the copy in my sent mail folder, it was there when I sent it. Oh 
  
 well, here it is inline for reference:  
  
 --- clamav-0.87.1/clamav-milter/clamav-milter.c.orig2005-10-25  
 22:40:59.0 +0100  
 +++ clamav-0.87.1/clamav-milter/clamav-milter.c 2005-12-12 20:33:56.0 
  
 +  
 @@ -4209,6 +4209,14 @@  
 }  
 offset = (off_t)0;  
 ret = sendfile(fout, fin, offset, statb.st_size);  
 +   if (ret  0  errno == EINVAL) {  
 +   unsigned char buf[512];  
 +   ssize_t n;  
 +  
 +   ret = 0;  
 +   while(ret = 0  (n = read(fin, buf, sizeof buf))  0)  
 +   ret = write(fout, buf, n);  
 +   }  
 close(fin);  
 if(ret  0) {  
 perror(newfile);  

--
Best regards,
imacat ^_*' [EMAIL PROTECTED]
PGP Key: http://www.imacat.idv.tw/me/pgpkey.txt

Woman's Voice News: http://www.wov.idv.tw/
Tavern IMACAT's: http://www.imacat.idv.tw/
TLUG List Manager: http://lists.linux.org.tw/cgi-bin/mailman/listinfo/tlug

___
http://lurker.clamav.net/list/clamav-devel.html


Re: [Clamav-devel] Patch to fix broken sendfile on Linux 2.6

2006-01-15 Thread simon-clam
On Sunday 15 January 2006 4:06 pm, imacat wrote:
 By the way, I have not found a clue on Google for a broken sendfile()
 on Linux 2.6.  But it seems to be true that sendfile() is good on Linux
 2.4 but not on Linux 2.6, after some simple tests myself.  Can anyone
 point out to me where to find more information on this?  Thank you.

The only thing I found with Google was this link:

http://ilia.ws/archives/13-sendfile-syscall-and-why-the-2.6-linux-kernel-sucks!.html

Simon
___
http://lurker.clamav.net/list/clamav-devel.html


Re: [Clamav-devel] Patch to fix broken sendfile on Linux 2.6

2005-12-14 Thread Simon Munton
On Wednesday 14 December 2005 7:52 am, Nigel Horne wrote:

 No attachment received, but I will look into it and provide a fix if
 needed for myself.

According to the copy in my sent mail folder, it was there when I sent it. Oh 
well, here it is inline for reference:

--- clamav-0.87.1/clamav-milter/clamav-milter.c.orig2005-10-25 
22:40:59.0 +0100
+++ clamav-0.87.1/clamav-milter/clamav-milter.c 2005-12-12 20:33:56.0 
+
@@ -4209,6 +4209,14 @@
}
offset = (off_t)0;
ret = sendfile(fout, fin, offset, statb.st_size);
+   if (ret  0  errno == EINVAL) {
+   unsigned char buf[512];
+   ssize_t n;
+
+   ret = 0;
+   while(ret = 0  (n = read(fin, buf, sizeof buf))  0)
+   ret = write(fout, buf, n);
+   }
close(fin);
if(ret  0) {
perror(newfile);


___
http://lurker.clamav.net/list/clamav-devel.html


Re: [Clamav-devel] Patch to fix broken sendfile on Linux 2.6

2005-12-13 Thread Nigel Horne

Simon Munton wrote:

Hi,

After I started using linux kernel 2.6, I found that virus emails were not 
being moved to the quarantine directory, and an 'Invalid argument' message 
was being logged.


I tracked this down to the call to sendfile in clamav-milter.c. It appears 
that on kernel 2.6, sendfile will not do a file to file copy.


The attached patch detects the sendfile failure, and falls back to a read then 
write copy loop


No attachment received, but I will look into it and provide a fix if 
needed for myself.



Simon




--
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, 
Typesetter.

NJH Music, Barnsley, UK.  ICQ#20252325
[EMAIL PROTECTED] http://www.bandsman.co.uk
___
http://lurker.clamav.net/list/clamav-devel.html