Prevent data loss caused by SIGINT during notmuch new
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Mar 2010 08:23:23 +0000 (10:23 +0200)
committerCarl Worth <cworth@cworth.org>
Tue, 13 Apr 2010 15:44:34 +0000 (08:44 -0700)
When Ctrl-C is pressed in a wrong time during notmuch new, it can lead
to removal of messages from the database even if the files were not
removed.

It happened at least once to me.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
notmuch-new.c

index 44b50aaa2c49ceea06825abea39256790f2c1a5d..484d94623fa13fb1b456a185e1f1eecc5133bfea 100644 (file)
@@ -454,6 +454,9 @@ add_files_recursive (notmuch_database_t *notmuch,
        next = NULL;
     }
 
+    if (interrupted)
+       goto DONE;
+
     /* Now that we've walked the whole filesystem list, anything left
      * over in the database lists has been deleted. */
     while (notmuch_filenames_valid (db_files))