Save and restore the access and modification time of the mailbox
authorJoey Schulze <joey@infodrom.org>
Mon, 22 Nov 2004 18:13:07 +0000 (18:13 +0000)
committerJoey Schulze <joey@infodrom.org>
Mon, 22 Nov 2004 18:13:07 +0000 (18:13 +0000)
mbox.c

diff --git a/mbox.c b/mbox.c
index eb70df8..0e895ef 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -20,6 +20,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <utime.h>
 #include <string.h>
 #include <strings.h>
 #include <ctype.h>
@@ -211,12 +212,18 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags)
 int watch_mbox(char *path, char *prefix, off_t *size, int opt_flags)
 {
   struct stat st;
+  struct utimbuf timbuf;
   int newmail = 0;
 
   if (stat(path, &st) == 0) {
     if (st.st_size > *size)
       if (access(path, R_OK) == 0) {
+       timbuf.actime = st.st_atime;
+       timbuf.modtime = st.st_mtime;
+
        newmail = inspect_mbox(path, prefix, *size, opt_flags);
+
+       utime(path, &timbuf);
       }
     *size = st.st_size;
     return newmail;