diff options
| author | David Bremner <david@tethera.net> | 2021-12-25 17:22:56 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-12-29 14:11:21 -0400 |
| commit | 25e0f5e59293ce961549201fdc74f81a3cc1675c (patch) | |
| tree | 03dc3d4369832c198835cc029120d620e25e404a /lib/open.cc | |
| parent | e43bad4883cf8a0c1d58d50238da599f9e170307 (diff) | |
lib/open: do not consider .notmuch alone as an existing database.
It makes perfect sense for users to want to pre-create .notmuch,
e.g. to install hooks, so we should handle the case of a .notmuch
directory without an actual xapian database more gracefully.
Diffstat (limited to 'lib/open.cc')
| -rw-r--r-- | lib/open.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/open.cc b/lib/open.cc index a942383b..4dd62a9f 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -662,16 +662,12 @@ notmuch_database_create_with_config (const char *database_path, err = mkdir (notmuch_path, 0755); if (err) { - if (errno == EEXIST) { - status = NOTMUCH_STATUS_DATABASE_EXISTS; - talloc_free (notmuch); - notmuch = NULL; - } else { + if (errno != EEXIST) { IGNORE_RESULT (asprintf (&message, "Error: Cannot create directory %s: %s.\n", notmuch_path, strerror (errno))); status = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; } - goto DONE; } } |
