unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: [PATCH] cli/new: replace newly deprecated n_m_has_maildir_flag
Date: Mon, 13 Jul 2020 20:51:07 -0300	[thread overview]
Message-ID: <20200713235107.543422-1-david@tethera.net> (raw)
In-Reply-To: <20200711183008.1593624-6-david@tethera.net>

Boolean return values have no out-of-band-values to signal errors. The
change here is that a (somewhat unlikely) fatal error after indexing
will now be caught.
---
 notmuch-new.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index f079f62a..4075d395 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -388,8 +388,11 @@ add_file (notmuch_database_t *notmuch, const char *filename,
 	    notmuch_message_maildir_flags_to_tags (message);
 
 	for (tag = state->new_tags; *tag != NULL; tag++) {
-	    if (strcmp ("unread", *tag) != 0 ||
-		! notmuch_message_has_maildir_flag (message, 'S')) {
+	    notmuch_bool_t is_set;
+	    /* Currently all errors from has_maildir_flag are fatal */
+	    if ((status = notmuch_message_has_maildir_flag_st (message, 'S', &is_set)))
+		goto DONE;
+	    if (strcmp ("unread", *tag) != 0 || ! is_set) {
 		notmuch_message_add_tag (message, *tag);
 	    }
 	}
-- 
2.27.0

  reply	other threads:[~2020-07-13 23:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11 18:30 fix deprecation warnings for notmuch_message_get_flag David Bremner
2020-07-11 18:30 ` [PATCH 1/5] cli/search: replace deprecated notmuch_message_get_flag David Bremner
2020-07-11 18:30 ` [PATCH 2/5] cli/show: " David Bremner
2020-07-11 18:30 ` [PATCH 3/5] lib/add-message: drop use of " David Bremner
2020-07-11 18:30 ` [PATCH 4/5] lib/thread: replace " David Bremner
2020-07-11 18:30 ` [PATCH 5/5] bindings/ruby: replacy " David Bremner
2020-07-13 23:51   ` David Bremner [this message]
2020-07-20 12:14     ` [PATCH] cli/new: replace newly deprecated n_m_has_maildir_flag David Bremner
2020-07-18 14:31 ` fix deprecation warnings for notmuch_message_get_flag David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200713235107.543422-1-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).