From 35310dc1367205238df0b43e949bd0949c7342e2 Mon Sep 17 00:00:00 2001 From: Adam Wolfe Gordon Date: Sun, 14 Jul 2013 18:45:44 +1800 Subject: [PATCH] [PATCH 1/3] cli: Return an error code from add_message_to_database --- 99/c8539fc3589a33fd323fb1bb22bb4a0486de32 | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 99/c8539fc3589a33fd323fb1bb22bb4a0486de32 diff --git a/99/c8539fc3589a33fd323fb1bb22bb4a0486de32 b/99/c8539fc3589a33fd323fb1bb22bb4a0486de32 new file mode 100644 index 000000000..25b561140 --- /dev/null +++ b/99/c8539fc3589a33fd323fb1bb22bb4a0486de32 @@ -0,0 +1,100 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 51C03431FBC + for ; Sat, 13 Jul 2013 17:55:49 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id kne9YvzV4uQQ for ; + Sat, 13 Jul 2013 17:55:48 -0700 (PDT) +Received: from smtp-out-01.shaw.ca (smtp-out-01.shaw.ca [64.59.136.137]) + by olra.theworths.org (Postfix) with ESMTP id 1BF96431FD0 + for ; Sat, 13 Jul 2013 17:55:37 -0700 (PDT) +X-Cloudmark-SP-Filtered: true +X-Cloudmark-SP-Result: v=1.1 cv=GLqYwptGXHjY6tPk5kWRtHXJM/YfZPTWiIs1znw4zms= + c=1 sm=1 + a=529rJtm0sH4A:10 a=BLceEmwcHowA:10 a=gumk1giGF0obp6xRQyl7Yg==:17 + a=6LECOPO3Nxskhww-8YwA:9 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 +Received: from unknown (HELO lagos.xvx.ca) ([68.150.39.45]) + by smtp-out-01.shaw.ca with ESMTP; 13 Jul 2013 18:46:01 -0600 +Received: by lagos.xvx.ca (Postfix, from userid 1000) + id ADDF48009323; Sat, 13 Jul 2013 18:46:01 -0600 (MDT) +From: Adam Wolfe Gordon +To: notmuch@notmuchmail.org +Subject: [PATCH 1/3] cli: Return an error code from add_message_to_database +Date: Sat, 13 Jul 2013 18:45:44 -0600 +Message-Id: <1373762746-22308-2-git-send-email-awg+notmuch@xvx.ca> +X-Mailer: git-send-email 1.7.9.5 +In-Reply-To: <1373762746-22308-1-git-send-email-awg+notmuch@xvx.ca> +References: <1373762746-22308-1-git-send-email-awg+notmuch@xvx.ca> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 14 Jul 2013 00:55:49 -0000 + +The error code isn't necessary when we're inserting a new message from +standard input, but it will be useful for an upcoming command that +allows an existing file to be indexed. +--- + notmuch-insert.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/notmuch-insert.c b/notmuch-insert.c +index 2207b1e..d32a535 100644 +--- a/notmuch-insert.c ++++ b/notmuch-insert.c +@@ -293,7 +293,7 @@ copy_stdin (int fdin, int fdout) + + /* Add the specified message file to the notmuch database, applying tags. + * The file is renamed to encode notmuch tags as maildir flags. */ +-static void ++static int + add_file_to_database (notmuch_database_t *notmuch, const char *path, + tag_op_list_t *tag_ops) + { +@@ -318,7 +318,7 @@ add_file_to_database (notmuch_database_t *notmuch, const char *path, + case NOTMUCH_STATUS_LAST_STATUS: + fprintf (stderr, "Error: failed to add `%s' to notmuch database: %s\n", + path, notmuch_status_to_string (status)); +- return; ++ return status; + } + + if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) { +@@ -331,6 +331,8 @@ add_file_to_database (notmuch_database_t *notmuch, const char *path, + } + + notmuch_message_destroy (message); ++ ++ return status; + } + + static notmuch_bool_t +@@ -377,7 +379,7 @@ insert_message (void *ctx, notmuch_database_t *notmuch, int fdin, + + /* Even if adding the message to the notmuch database fails, + * the message is on disk and we consider the delivery completed. */ +- add_file_to_database (notmuch, newpath, tag_ops); ++ (void) add_file_to_database (notmuch, newpath, tag_ops); + + return TRUE; + +-- +1.7.9.5 + -- 2.26.2