X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fdatabase.cc;h=6a15174959812cbb73455670038e55415b5a3105;hb=32fd74b7aa9c24ec77f8c59d09f89e0535bf64cd;hp=e726f629dc89af2f1657125530d6889b9be02651;hpb=b59ad1a9cc6ea03764b1cd3d038920581ac5a9c4;p=notmuch diff --git a/lib/database.cc b/lib/database.cc index e726f629..6a151749 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -659,6 +659,12 @@ notmuch_database_create_verbose (const char *path, goto DONE; } + if (path[0] != '/') { + message = strdup ("Error: Database path must be absolute.\n"); + status = NOTMUCH_STATUS_PATH_ERROR; + goto DONE; + } + err = stat (path, &st); if (err) { IGNORE_RESULT (asprintf (&message, "Error: Cannot create database at %s: %s.\n", @@ -849,6 +855,12 @@ notmuch_database_open_verbose (const char *path, goto DONE; } + if (path[0] != '/') { + message = strdup ("Error: Database path must be absolute.\n"); + status = NOTMUCH_STATUS_PATH_ERROR; + goto DONE; + } + if (! (notmuch_path = talloc_asprintf (local, "%s/%s", path, ".notmuch"))) { message = strdup ("Out of memory\n"); status = NOTMUCH_STATUS_OUT_OF_MEMORY;