lib: Make notmuch_database_find_message_by_filename not crash on read-only databases

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.
This commit is contained in:
Austin Clements 2012-05-18 00:13:40 -04:00 committed by David Bremner
parent f1f1e39639
commit cdd698f969

View file

@ -1895,8 +1895,8 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
try { try {
status = _notmuch_database_filename_to_direntry ( status = _notmuch_database_filename_to_direntry (
local, notmuch, filename, NOTMUCH_FIND_CREATE, &direntry); local, notmuch, filename, NOTMUCH_FIND_LOOKUP, &direntry);
if (status) if (status || !direntry)
goto DONE; goto DONE;
term = talloc_asprintf (local, "%s%s", prefix, direntry); term = talloc_asprintf (local, "%s%s", prefix, direntry);