X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fmessage-file.c;h=9e9b387fcc697a8e8b3d13a8bbbd03147714ef58;hb=e823d05ae6dc920d4fc9abf774c3d2575d891d7b;hp=311bd478b0cfff13620ba653795ccb9cd62246bf;hpb=c477d7ce311335fda16a15e624ca3931d79144cf;p=notmuch diff --git a/lib/message-file.c b/lib/message-file.c index 311bd478..9e9b387f 100644 --- a/lib/message-file.c +++ b/lib/message-file.c @@ -64,12 +64,13 @@ _notmuch_message_file_open_ctx (notmuch_database_t *notmuch, if (unlikely (message == NULL)) return NULL; - const char *prefix = notmuch_database_get_path (notmuch); + const char *prefix = notmuch_config_get (notmuch, NOTMUCH_CONFIG_MAIL_ROOT); + if (prefix == NULL) goto FAIL; if (*filename == '/') { - if (strncmp (filename, prefix, strlen(prefix)) != 0) { + if (strncmp (filename, prefix, strlen (prefix)) != 0) { _notmuch_database_log (notmuch, "Error opening %s: path outside mail root\n", filename); errno = 0; @@ -77,7 +78,7 @@ _notmuch_message_file_open_ctx (notmuch_database_t *notmuch, } message->filename = talloc_strdup (message, filename); } else { - message->filename = talloc_asprintf(message, "%s/%s", prefix, filename); + message->filename = talloc_asprintf (message, "%s/%s", prefix, filename); } if (message->filename == NULL)