aboutsummaryrefslogtreecommitdiff
path: root/lib/config.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-01-10 10:54:03 -0400
committerDavid Bremner <david@tethera.net>2022-01-10 10:54:03 -0400
commit1b58ea1e66997efdd7ea2a7a83f76890de40fe04 (patch)
tree7db3d1aedaf2ae8e1ff0851ff8c56658273d074e /lib/config.cc
parent235b876793ec885b78c7b31904fd69d1a82fbe4a (diff)
parent2394ee6289a2fc2628f198b4a9920116148dd814 (diff)
Merge tag 'debian/0.34.2-1' into debian/bullseye-backports
notmuch release 0.34.2-1 for unstable (sid) [dgit] [dgit distro=debian no-split --quilt=linear]
Diffstat (limited to 'lib/config.cc')
-rw-r--r--lib/config.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/config.cc b/lib/config.cc
index 8775b00a..e502858d 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -259,7 +259,15 @@ _notmuch_config_load_from_database (notmuch_database_t *notmuch)
for (; notmuch_config_list_valid (list); notmuch_config_list_move_to_next (list)) {
const char *key = notmuch_config_list_key (list);
- char *normalized_val = _expand_path (list, key, notmuch_config_list_value (list));
+ char *normalized_val = NULL;
+
+ /* If we opened from a given path, do not overwrite it */
+ if (strcmp (key, "database.path") == 0 &&
+ (notmuch->params & NOTMUCH_PARAM_DATABASE) &&
+ notmuch->xapian_db)
+ continue;
+
+ normalized_val = _expand_path (list, key, notmuch_config_list_value (list));
_notmuch_string_map_append (notmuch->config, key, normalized_val);
talloc_free (normalized_val);
}
@@ -432,6 +440,13 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
}
+
+ /* If we opened from a given path, do not overwrite it */
+ if (strcmp (absolute_key, "database.path") == 0 &&
+ (notmuch->params & NOTMUCH_PARAM_DATABASE) &&
+ notmuch->xapian_db)
+ continue;
+
normalized_val = _expand_path (notmuch, absolute_key, val);
_notmuch_string_map_set (notmuch->config, absolute_key, normalized_val);
g_free (val);