[PATCH 7/9] lib: Make notmuch_database_find_message_by_filename not crash on read-only databases

Austin Clements amdragon at MIT.EDU
Thu May 17 21:13:40 PDT 2012


Previously, _notmuch_database_filename_to_direntry would abort with an
internal error when called on a read-only database.  Now that creating
the directory document is optional,
notmuch_database_find_message_by_filename can disable directory
document creation (as it should) and, as a result, not abort on
read-only databases.
---
 lib/database.cc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index e27a0e1..761dc1a 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1895,8 +1895,8 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
 
     try {
 	status = _notmuch_database_filename_to_direntry (
-	    local, notmuch, filename, NOTMUCH_FIND_CREATE, &direntry);
-	if (status)
+	    local, notmuch, filename, NOTMUCH_FIND_LOOKUP, &direntry);
+	if (status || !direntry)
 	    goto DONE;
 
 	term = talloc_asprintf (local, "%s%s", prefix, direntry);
-- 
1.7.10



More information about the notmuch mailing list