X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=contrib%2Fnotmuch-deliver%2Fsrc%2Fmain.c;h=032b9d6297daa14f850b4cccfb83013e53716070;hb=2fee62fd1fcaed5c9ec46daa4f24b33a2f310e83;hp=6f32f73d68b97decbe382b3dc84cffc3e99f259d;hpb=be2263e93035e778968e92d1b4db0166686be71b;p=notmuch diff --git a/contrib/notmuch-deliver/src/main.c b/contrib/notmuch-deliver/src/main.c index 6f32f73d..032b9d62 100644 --- a/contrib/notmuch-deliver/src/main.c +++ b/contrib/notmuch-deliver/src/main.c @@ -359,6 +359,7 @@ main(int argc, char **argv) GOptionContext *ctx; GError *error = NULL; notmuch_database_t *db; + notmuch_status_t status; ctx = g_option_context_new("[FOLDER]"); g_option_context_add_main_entries(ctx, options, PACKAGE); @@ -429,7 +430,14 @@ main(int argc, char **argv) maildir = g_strdup(db_path); g_debug("Opening notmuch database `%s'", db_path); - db = notmuch_database_open(db_path, NOTMUCH_DATABASE_MODE_READ_WRITE); + status = notmuch_database_open(db_path, NOTMUCH_DATABASE_MODE_READ_WRITE, + &db); + if (status) { + g_critical("Failed to open database `%s': %s", + db_path, notmuch_status_to_string(status)); + g_free(maildir); + return EX_SOFTWARE; + } g_free(db_path); if (db == NULL) return EX_SOFTWARE; @@ -455,7 +463,7 @@ main(int argc, char **argv) g_strfreev(opt_rtags); g_free(mail); - notmuch_database_close(db); + notmuch_database_destroy(db); return 0; }