diff options
author | David Bremner <david@tethera.net> | 2021-02-17 07:16:54 -0400 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2021-03-20 07:50:13 -0300 |
commit | e3a4abc513d314cf7550d43fdcba458421a2daac (patch) | |
tree | fc6f53a53e19616622eb5b709f9ab9bbfc8870ca /lib | |
parent | b30a59157d5ba0421c01fa3dc05d238d18738839 (diff) |
lib/open: fix hook directory calculation in split configuration
Choose sibling directory of xapian database, as .notmuch may not
exist.
libgen.h is already used in debugger.c, so it is not a new dependency
/ potential portability problem.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/open.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/open.cc b/lib/open.cc index 886c1c90..ec0de4c3 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -1,4 +1,6 @@ #include <unistd.h> +#include <libgen.h> + #include "database-private.h" #include "parse-time-vrp.h" @@ -92,8 +94,8 @@ _choose_hook_dir (notmuch_database_t *notmuch, err = stat (hook_dir, &st); if (err) { if (errno == ENOENT) { - const char *database_path = notmuch_database_get_path (notmuch); - hook_dir = talloc_asprintf (notmuch, "%s/.notmuch/hooks", database_path); + char *notmuch_path = dirname (talloc_strdup (notmuch, notmuch->xapian_path)); + hook_dir = talloc_asprintf (notmuch, "%s/hooks", notmuch_path); } else { IGNORE_RESULT (asprintf (message, "Error: Cannot stat %s: %s.\n", hook_dir, strerror (errno))); |