Re: [PATCH 1/2] cli/insert: delay database open until after writing mail file
David Bremner writes: > The idea is to get the mail written to disk, even if we can't open the > database (e.g. because some other process has a write lock, and notmuch > is compiled for non-blocking opens). > --- > notmuch-insert.c | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/notmuch-insert.c b/notmuch-insert.c > index 131f09e..862da88 100644 > --- a/notmuch-insert.c > +++ b/notmuch-insert.c > @@ -532,19 +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; > - > -notmuch_exit_if_unmatched_db_uuid (notmuch); > - > /* 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); > + > + One extra newline here. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/2] cli/insert: delay database open until after writing mail file
The idea is to get the mail written to disk, even if we can't open the database (e.g. because some other process has a write lock, and notmuch is compiled for non-blocking opens). --- notmuch-insert.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/notmuch-insert.c b/notmuch-insert.c index 131f09e..862da88 100644 --- a/notmuch-insert.c +++ b/notmuch-insert.c @@ -532,19 +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; - -notmuch_exit_if_unmatched_db_uuid (notmuch); - /* 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); -- 2.10.2 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch