X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-count.c;h=97281374b22252059fcbf65ff28d426615b2a632;hb=536d695a3151f78a0aed0a902298ac53826c46d6;hp=cf80ee25a102fc4f469fc26ce50c85bf8096eb1e;hpb=3721bd45d72e50436ee760b03ae533d49bbb8724;p=notmuch diff --git a/notmuch-count.c b/notmuch-count.c index cf80ee25..97281374 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -87,8 +87,13 @@ print_count (notmuch_database_t *notmuch, const char *query_str, return -1; } - for (i = 0; i < exclude_tags_length; i++) - notmuch_query_add_tag_exclude (query, exclude_tags[i]); + for (i = 0; i < exclude_tags_length; i++) { + status = notmuch_query_add_tag_exclude (query, exclude_tags[i]); + if (status && status != NOTMUCH_STATUS_IGNORED) { + print_status_query ("notmuch count", query, status); + return -1; + } + } switch (output) { case OUTPUT_MESSAGES: @@ -106,7 +111,7 @@ print_count (notmuch_database_t *notmuch, const char *query_str, case OUTPUT_FILES: count = count_files (query); if (count >= 0) { - printf ("%u", count); + printf ("%d", count); } else { ret = -1; goto DONE; @@ -199,6 +204,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]) if (batch && opt_index != argc) { fprintf (stderr, "--batch and query string are not compatible\n"); + if (input) + fclose (input); return EXIT_FAILURE; }