X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-insert.c;h=862da8892df78ce3ef8587d90e41b299befe274f;hb=9259b97fa2659ae6b6dbcd49b04db087e64036ad;hp=c277d6206712a23718cbd4c75d55c7fc3bb688e7;hpb=8cca886b10c5ec44f3214701c0c1e3c896d53d5c;p=notmuch diff --git a/notmuch-insert.c b/notmuch-insert.c index c277d620..862da889 100644 --- a/notmuch-insert.c +++ b/notmuch-insert.c @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ . + * along with this program. If not, see https://www.gnu.org/licenses/ . * * Author: Peter Wang */ @@ -532,17 +532,19 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]) action.sa_flags = 0; sigaction (SIGINT, &action, NULL); - if (notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much)) - return EXIT_FAILURE; - /* Write the message to the Maildir new directory. */ newpath = maildir_write_new (config, STDIN_FILENO, maildir); if (! newpath) { - notmuch_database_destroy (notmuch); return EXIT_FAILURE; } + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much)) + return EXIT_FAILURE; + + notmuch_exit_if_unmatched_db_uuid (notmuch); + + /* Index the message. */ status = add_file (notmuch, newpath, tag_ops, synchronize_flags, keep);