--- clamav-0.86.2/clamscan/manager.c.orig	2005-07-25 00:22:47.000000000 +0200
+++ clamav-0.86.2/clamscan/manager.c	2005-09-09 18:55:52.995231000 +0200
@@ -752,10 +752,17 @@
 {
 	int fd, ret;
 	const char *virname;
+	struct stat stat0;
+	struct utimbuf utimbuf0;
 
 
     mprintf("*Scanning %s\n", filename);
 
+    if (atime_preserve && (stat(filename, &stat0) == -1)) {
+	mprintf("@Can't stat file %s\n", filename);
+	return 54;
+    }
+
     if((fd = open(filename, O_RDONLY)) == -1) {
 	mprintf("@Can't open file %s\n", filename);
 	return 54;
@@ -777,6 +784,11 @@
 	    mprintf("%s: %s\n", filename, cl_strerror(ret));
 
     close(fd);
+    if (atime_preserve) {
+	utimbuf0.actime = stat0.st_atime;
+	utimbuf0.modtime = stat0.st_mtime;
+	utime(filename, &utimbuf0);
+    }
     return ret;
 }
 
--- clamav-0.86.2/clamscan/shared.h.orig	2005-06-23 22:03:09.000000000 +0200
+++ clamav-0.86.2/clamscan/shared.h	2005-09-09 18:54:41.961464000 +0200
@@ -31,6 +31,6 @@
 };
 
 extern struct s_info claminfo;
-extern short recursion, printinfected, bell;
+extern short recursion, printinfected, bell, atime_preserve;
 
 #endif
--- clamav-0.86.2/clamscan/clamscan.c.orig	2005-07-25 00:19:05.000000000 +0200
+++ clamav-0.86.2/clamscan/clamscan.c	2005-09-09 18:55:31.081301000 +0200
@@ -44,7 +44,7 @@
 void help(void);
 
 struct s_info claminfo;
-short recursion = 0, printinfected = 0, bell = 0;
+short recursion = 0, printinfected = 0, bell = 0, atime_preserve = 0;
 
 int clamscan(struct optstruct *opt)
 {
@@ -106,6 +106,9 @@
     if(optl(opt, "leave-temps"))
 	cl_settempdir(NULL, 1);
 
+    if(optl(opt, "atime-preserve"))
+	atime_preserve = 1;
+
     /* initialize logger */
 
     if(optc(opt, 'l')) {
@@ -221,6 +224,7 @@
     mprintf("\n");
     mprintf("    --tempdir=DIRECTORY                  Create temporary files in DIRECTORY\n");
     mprintf("    --leave-temps                        Do not remove temporary files\n");
+    mprintf("    --atime-preserve                     Restore files access times\n");
     mprintf("    --database=FILE/DIR   -d FILE/DIR    Load virus database from FILE or load\n");
     mprintf("                                         all .cvd and .db[2] files from DIR\n");
     mprintf("    --log=FILE            -l FILE        Save scan report to FILE\n");
--- clamav-0.86.2/clamscan/options.c.orig	2005-06-23 22:03:09.000000000 +0200
+++ clamav-0.86.2/clamscan/options.c	2005-09-09 21:35:10.519933000 +0200
@@ -41,7 +41,7 @@
 static char *clamdscan_long[] = { "help", "version", "verbose", "quiet",
 				  "stdout", "log", "move", "remove",
 				  "config-file", "no-summary",
-				  "disable-summary", NULL };
+				  "disable-summary", "atime-preserve", NULL };
 
 static char clamdscan_short[] = { 'h', 'V', 'v', 'l', 0 };
 
@@ -73,6 +73,7 @@
 	    {"force", 0, 0, 0},
 	    {"recursive", 0, 0, 'r'},
 	    {"bell", 0, 0, 0},
+	    {"atime-preserve", 0, 0, 0},
 	    {"disable-summary", 0, 0, 0}, /* obsolete */
 	    {"no-summary", 0, 0, 0},
 	    {"infected", 0, 0, 'i'},
