From 02a30767116ad8abcbd0a3351f2e4d43bbbd655f Mon Sep 17 00:00:00 2001 From: Ali Polatel Date: Tue, 4 Oct 2011 07:55:29 +0300 Subject: lib: make find_message{,by_filename) report errors Previously, the functions notmuch_database_find_message() and notmuch_database_find_message_by_filename() functions did not properly report error condition to the library user. For more information, read the thread on the notmuch mailing list starting with my mail "id:871uv2unfd.fsf@gmail.com" Make these functions accept a pointer to 'notmuch_message_t' as argument and return notmuch_status_t which may be used to check for any error condition. restore: Modify for the new notmuch_database_find_message() new: Modify for the new notmuch_database_find_message_by_filename() --- notmuch-new.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'notmuch-new.c') diff --git a/notmuch-new.c b/notmuch-new.c index e79593cd..96a1e31e 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -743,7 +743,9 @@ remove_filename (notmuch_database_t *notmuch, status = notmuch_database_begin_atomic (notmuch); if (status) return status; - message = notmuch_database_find_message_by_filename (notmuch, path); + status = notmuch_database_find_message_by_filename (notmuch, path, &message); + if (status || message == NULL) + return status; status = notmuch_database_remove_message (notmuch, path); if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) { add_files_state->renamed_messages++; -- cgit v1.2.3