notmuch new: Avoid updating directory timestamp if interrupted.
authorCarl Worth <cworth@cworth.org>
Tue, 5 Jan 2010 23:23:52 +0000 (15:23 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 6 Jan 2010 18:32:06 +0000 (10:32 -0800)
This was a very dangerous bug. An interrupted "notmuch new" session
would still update the timestamp for the directory in the
database. This would result in mail files that were not processed due
to the original interruption *never* being picked up by future runs of
"notmuch new". Yikes!

notmuch-new.c

index ca68a68473af918dc7004762a8f42f3c85007a67..4adbdc7f60ff4280e7fe2255975afa17bf689a87 100644 (file)
@@ -290,9 +290,11 @@ add_files_recursive (notmuch_database_t *notmuch,
        next = NULL;
     }
 
-    status = notmuch_directory_set_mtime (directory, path_mtime);
-    if (status && ret == NOTMUCH_STATUS_SUCCESS)
-       ret = status;
+    if (! interrupted) {
+       status = notmuch_directory_set_mtime (directory, path_mtime);
+       if (status && ret == NOTMUCH_STATUS_SUCCESS)
+           ret = status;
+    }
 
   DONE:
     if (next)