X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fopen.cc;h=46a0154534886b77e446604219023e5de5c790d4;hb=fc3c79dd37d4bae938a5d0a1d7773bea48dd09b4;hp=77f01f727b6bdae860e4f7c84ce22c6af99e3a91;hpb=74c4ce6d88bcc643424c5d89cc8d30cd835e46c3;p=notmuch diff --git a/lib/open.cc b/lib/open.cc index 77f01f72..46a01545 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -19,9 +19,8 @@ notmuch_database_open (const char *path, char *status_string = NULL; notmuch_status_t status; - status = notmuch_database_open_verbose (path, mode, database, - &status_string); - + status = notmuch_database_open_with_config (path, mode, "", NULL, + database, &status_string); if (status_string) { fputs (status_string, stderr); free (status_string); @@ -714,10 +713,16 @@ notmuch_database_create_with_config (const char *database_path, else free (message); } + if (status && notmuch) { + notmuch_database_destroy (notmuch); + notmuch = NULL; + } + if (database) *database = notmuch; - else - talloc_free (notmuch); + + if (notmuch) + notmuch->open = true; return status; } @@ -865,6 +870,13 @@ notmuch_database_load_config (const char *database_path, if (status_string) *status_string = message; + if (status && + status != NOTMUCH_STATUS_NO_DATABASE + && status != NOTMUCH_STATUS_NO_CONFIG) { + notmuch_database_destroy (notmuch); + notmuch = NULL; + } + if (database) *database = notmuch;