Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes: > It makes no sense to stop indexing a message just because one of the > parts failed to decrypt, so i'm not going to immediately return. > > I'm willing to accept that only the last log message will make it out to > the caller, and i could track whether anything has been written to the > log and change the return value in that case. would that be acceptable? > That sounds like an improvement. Other options I can think of - accumulate an error string. With talloc_asprintf_append, this is not _too_ terrible. Making a second logging function [1] that didn't clear the log buffer but appended would maybe make sense (aside from contradicting what I said in the previous message). This would still need some status return to alert the caller. - Pass a logging callback; this requires API changes. We already have a such a callback for notmuch_database_compact. While thinking about this, I noticed several suspect uses of _notmuch_database_log in current index.cc, at least in _index_mime_part. These are probably my fault, resulting from blindly replacing printfs. [1]: untested: void _notmuch_database_log_append (notmuch_database_t *notmuch, const char *format, ...) { va_list va_args; va_start (va_args, format); if (notmuch->status_string) notmuch->status_string = talloc_vasprintf_append (notmuch->status_string, format, va_args) else notmuch->status_string = talloc_vasprintf (notmuch, format, va_args); va_end (va_args); }