git-svn: trunk@3728
aCaB authored on 2008/03/21 05:45:37... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Thu Mar 20 20:55:37 CET 2008 (acab) |
|
2 |
+----------------------------------- |
|
3 |
+ * libclamav: Remove fsync()'s. Win32 ports should greatly benefit from it |
|
4 |
+ Please report problems. - bb#844 |
|
5 |
+ |
|
1 | 6 |
Thu Mar 20 12:16:13 CET 2008 (tk) |
2 | 7 |
--------------------------------- |
3 | 8 |
* clamdscan/client.c: some messages were being printed twice (bb#884) |
... | ... |
@@ -371,7 +371,6 @@ static int ea05(int desc, cli_ctx *ctx, char *tmpd) { |
371 | 371 |
cli_dbgmsg("autoit: file extracted to %s\n", tempfile); |
372 | 372 |
else |
373 | 373 |
cli_dbgmsg("autoit: file successfully extracted\n"); |
374 |
- fsync(i); |
|
375 | 374 |
lseek(i, 0, SEEK_SET); |
376 | 375 |
if(cli_magic_scandesc(i, ctx) == CL_VIRUS) { |
377 | 376 |
close(i); |
... | ... |
@@ -880,7 +879,6 @@ static int ea06(int desc, cli_ctx *ctx, char *tmpd) { |
880 | 880 |
cli_dbgmsg("autoit: %s extracted to %s\n", (script)?"script":"file", tempfile); |
881 | 881 |
else |
882 | 882 |
cli_dbgmsg("autoit: %s successfully extracted\n", (script)?"script":"file"); |
883 |
- fsync(i); |
|
884 | 883 |
lseek(i, 0, SEEK_SET); |
885 | 884 |
if(cli_magic_scandesc(i, ctx) == CL_VIRUS) { |
886 | 885 |
close(i); |
... | ... |
@@ -48,7 +48,7 @@ extern "C" |
48 | 48 |
#define CL_EACCES -110 /* access denied */ |
49 | 49 |
#define CL_ENULLARG -111 /* null argument */ |
50 | 50 |
#define CL_ETMPFILE -112 /* tmpfile() failed */ |
51 |
-#define CL_EFSYNC -113 /* fsync() failed */ |
|
51 |
+/* #define CL_EFSYNC -113 *//* fsync() failed */ |
|
52 | 52 |
#define CL_EMEM -114 /* memory allocation error */ |
53 | 53 |
#define CL_EOPEN -115 /* file open error */ |
54 | 54 |
#define CL_EMALFDB -116 /* malformed database */ |
... | ... |
@@ -167,8 +167,6 @@ const char *cl_strerror(int clerror) |
167 | 167 |
return "Unable to create temporary file"; |
168 | 168 |
case CL_ETMPDIR: |
169 | 169 |
return "Unable to create temporary directory"; |
170 |
- case CL_EFSYNC: |
|
171 |
- return "Unable to synchronize file <-> disk"; |
|
172 | 170 |
case CL_EMEM: |
173 | 171 |
return "Unable to allocate memory"; |
174 | 172 |
case CL_EOPEN: |
... | ... |
@@ -130,7 +130,6 @@ if((ndesc = open(tempfile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IRWXU)) < 0) { \ |
130 | 130 |
cli_dbgmsg(NAME": Unpacked and rebuilt executable\n"); \ |
131 | 131 |
cli_multifree FREEME; \ |
132 | 132 |
free(exe_sections); \ |
133 |
- fsync(ndesc); \ |
|
134 | 133 |
lseek(ndesc, 0, SEEK_SET); \ |
135 | 134 |
cli_dbgmsg("***** Scanning rebuilt PE file *****\n"); \ |
136 | 135 |
if(cli_magic_scandesc(ndesc, ctx) == CL_VIRUS) { \ |
... | ... |
@@ -1736,7 +1735,6 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
1736 | 1736 |
} |
1737 | 1737 |
|
1738 | 1738 |
free(dest); |
1739 |
- fsync(ndesc); |
|
1740 | 1739 |
lseek(ndesc, 0, SEEK_SET); |
1741 | 1740 |
|
1742 | 1741 |
if(cli_leavetemps_flag) |
... | ... |
@@ -502,15 +502,6 @@ static int cli_scangzip(int desc, cli_ctx *ctx) |
502 | 502 |
return ret; |
503 | 503 |
} |
504 | 504 |
|
505 |
- if(fsync(fd) == -1) { |
|
506 |
- cli_dbgmsg("GZip: Can't synchronise descriptor %d\n", fd); |
|
507 |
- close(fd); |
|
508 |
- if(!cli_leavetemps_flag) |
|
509 |
- unlink(tmpname); |
|
510 |
- free(tmpname); |
|
511 |
- return CL_EFSYNC; |
|
512 |
- } |
|
513 |
- |
|
514 | 505 |
lseek(fd, 0, SEEK_SET); |
515 | 506 |
if((ret = cli_magic_scandesc(fd, ctx)) == CL_VIRUS ) { |
516 | 507 |
cli_dbgmsg("GZip: Infected with %s\n", *ctx->virname); |
... | ... |
@@ -611,16 +602,6 @@ static int cli_scanbzip(int desc, cli_ctx *ctx) |
611 | 611 |
return ret; |
612 | 612 |
} |
613 | 613 |
|
614 |
- if(fsync(fd) == -1) { |
|
615 |
- cli_dbgmsg("Bzip: Synchronisation failed for descriptor %d\n", fd); |
|
616 |
- close(fd); |
|
617 |
- if(!cli_leavetemps_flag) |
|
618 |
- unlink(tmpname); |
|
619 |
- free(tmpname); |
|
620 |
- fclose(fs); |
|
621 |
- return CL_EFSYNC; |
|
622 |
- } |
|
623 |
- |
|
624 | 614 |
lseek(fd, 0, SEEK_SET); |
625 | 615 |
if((ret = cli_magic_scandesc(fd, ctx)) == CL_VIRUS ) { |
626 | 616 |
cli_dbgmsg("Bzip: Infected with %s\n", *ctx->virname); |
... | ... |
@@ -1058,7 +1039,6 @@ static int cli_scanhtml_utf16(int desc, cli_ctx *ctx) |
1058 | 1058 |
} |
1059 | 1059 |
} |
1060 | 1060 |
|
1061 |
- fsync(fd); |
|
1062 | 1061 |
lseek(fd, 0, SEEK_SET); |
1063 | 1062 |
ret = cli_scanhtml(fd, ctx); |
1064 | 1063 |
close(fd); |
... | ... |
@@ -1352,13 +1332,6 @@ static int cli_scancryptff(int desc, cli_ctx *ctx) |
1352 | 1352 |
|
1353 | 1353 |
free(dest); |
1354 | 1354 |
|
1355 |
- if(fsync(ndesc) == -1) { |
|
1356 |
- cli_errmsg("CryptFF: Can't fsync descriptor %d\n", ndesc); |
|
1357 |
- close(ndesc); |
|
1358 |
- free(tempfile); |
|
1359 |
- return CL_EIO; |
|
1360 |
- } |
|
1361 |
- |
|
1362 | 1355 |
lseek(ndesc, 0, SEEK_SET); |
1363 | 1356 |
|
1364 | 1357 |
cli_dbgmsg("CryptFF: Scanning decrypted data\n"); |
... | ... |
@@ -1523,15 +1496,6 @@ static int cli_scanembpe(int desc, cli_ctx *ctx) |
1523 | 1523 |
} |
1524 | 1524 |
} |
1525 | 1525 |
|
1526 |
- if(fsync(fd) == -1) { |
|
1527 |
- cli_dbgmsg("cli_scanembpe: Can't synchronise descriptor %d\n", fd); |
|
1528 |
- close(fd); |
|
1529 |
- if(!cli_leavetemps_flag) |
|
1530 |
- unlink(tmpname); |
|
1531 |
- free(tmpname); |
|
1532 |
- return CL_EFSYNC; |
|
1533 |
- } |
|
1534 |
- |
|
1535 | 1526 |
ctx->recursion++; |
1536 | 1527 |
lseek(fd, 0, SEEK_SET); |
1537 | 1528 |
if((ret = cli_magic_scandesc(fd, ctx)) == CL_VIRUS) { |