- notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
-
- if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
- mode = NOTMUCH_DATABASE_MODE_READ_WRITE;
- if (notmuch_database_open_with_config (NULL,
- mode,
- _notmuch_config_get_path (config),
- NULL,
- ¬much,
- &status_string)) {
- if (status_string) {
- fputs (status_string, stderr);
- free (status_string);
+ if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE) {
+ status = notmuch_database_reopen (notmuch, NOTMUCH_DATABASE_MODE_READ_WRITE);
+ if (status) {
+ fprintf (stderr, "Error reopening database for READ_WRITE: %s\n",
+ notmuch_status_to_string (status));
+ return EXIT_FAILURE;