git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@172 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/01/08 05:53:31... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Wed Jan 7 21:50:28 CET 2004 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * clamscan: removed support for sendfile() under Linux |
|
4 |
+ |
|
1 | 5 |
Tue Jan 6 14:42:00 GMT 2004 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav: Handle headers which do not not have a space after the ':' |
... | ... |
@@ -39,10 +39,6 @@ |
39 | 39 |
#include <target.h> |
40 | 40 |
#include <clamav.h> |
41 | 41 |
|
42 |
-#ifdef C_LINUX /* njh@bandsman.co.uk */ |
|
43 |
-#include <sys/sendfile.h> |
|
44 |
-#endif |
|
45 |
- |
|
46 | 42 |
#include "shared.h" |
47 | 43 |
#include "others.h" |
48 | 44 |
#include "defaults.h" |
... | ... |
@@ -375,14 +371,8 @@ int writeaccess(const char *path, const char *username) |
375 | 375 |
|
376 | 376 |
int filecopy(const char *src, const char *dest) |
377 | 377 |
{ |
378 |
-#ifdef C_LINUX |
|
379 |
- struct stat statb; |
|
380 |
- int s, d; |
|
381 |
- off_t offset; |
|
382 |
-#else |
|
383 | 378 |
char buffer[FILEBUFF]; |
384 | 379 |
int s, d, bytes; |
385 |
-#endif |
|
386 | 380 |
|
387 | 381 |
if((s = open(src, O_RDONLY)) == -1) |
388 | 382 |
return -1; |
... | ... |
@@ -392,27 +382,8 @@ int filecopy(const char *src, const char *dest) |
392 | 392 |
return -1; |
393 | 393 |
} |
394 | 394 |
|
395 |
-#ifdef C_LINUX |
|
396 |
- /* njh@bandsman.co.uk: sendfile is much quicker */ |
|
397 |
- if(fstat(s, &statb) < 0) { |
|
398 |
- perror(src); |
|
399 |
- close(s); |
|
400 |
- close(d); |
|
401 |
- unlink(dest); |
|
402 |
- return -1; |
|
403 |
- } |
|
404 |
- offset = 0L; |
|
405 |
- if(sendfile(d, s, &offset, statb.st_size) < 0) { |
|
406 |
- perror(dest); |
|
407 |
- close(s); |
|
408 |
- close(d); |
|
409 |
- unlink(dest); |
|
410 |
- return -1; |
|
411 |
- } |
|
412 |
-#else |
|
413 | 395 |
while((bytes = read(s, buffer, FILEBUFF)) > 0) |
414 | 396 |
write(d, buffer, bytes); |
415 |
-#endif |
|
416 | 397 |
|
417 | 398 |
close(s); |
418 | 399 |
|