[PATCH 1/2] notmuch-deliver: Retry with readwrite if splice() fails
authorDavid Riebenbauer <davrieb@liegesta.at>
Sun, 6 Nov 2011 05:34:27 +0000 (06:34 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:39:59 +0000 (09:39 -0800)
29/df8999757a64bb6086b2a4de505cb672a562a8 [new file with mode: 0644]

diff --git a/29/df8999757a64bb6086b2a4de505cb672a562a8 b/29/df8999757a64bb6086b2a4de505cb672a562a8
new file mode 100644 (file)
index 0000000..a6d2d4c
--- /dev/null
@@ -0,0 +1,75 @@
+Return-Path: <davrieb@liegesta.at>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id B501F429E27\r
+       for <notmuch@notmuchmail.org>; Sat,  5 Nov 2011 22:34:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id ojUjUN0bkdEX for <notmuch@notmuchmail.org>;\r
+       Sat,  5 Nov 2011 22:34:47 -0700 (PDT)\r
+Received: from plum.liegesta.at (plum.liegesta.at [83.169.17.237])\r
+       by olra.theworths.org (Postfix) with ESMTP id 13CCF429E21\r
+       for <notmuch@notmuchmail.org>; Sat,  5 Nov 2011 22:34:47 -0700 (PDT)\r
+Received: from ambiguous-mid.liegesta.at (mk046207255003.a1.net\r
+ [46.207.255.3])       (Authenticated sender: davrieb) by plum.liegesta.at (Postfix)\r
+ with ESMTPA id 0B95227B8230;  Sun,  6 Nov 2011 06:34:45 +0100 (CET)\r
+Received: by ambiguous-mid.liegesta.at (Postfix, from userid 1000)\r
+       id 67A0F20077; Sun,  6 Nov 2011 06:34:39 +0100 (CET)\r
+From: David Riebenbauer <davrieb@liegesta.at>\r
+To: Notmuch Mailing List <notmuch@notmuchmail.org>\r
+Subject: [PATCH 1/2] notmuch-deliver: Retry with readwrite if splice() fails\r
+Date: Sun,  6 Nov 2011 06:34:27 +0100\r
+Message-Id: <1320557668-2314-1-git-send-email-davrieb@liegesta.at>\r
+X-Mailer: git-send-email 1.7.7.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 06 Nov 2011 05:34:47 -0000\r
+\r
+notmuch-deliver should not just fail, when splice() doesn't work. Fall\r
+back to the readwrite method even if NOTMUCH_DELIVER_NO_SPLICE is not\r
+set.\r
+---\r
+ contrib/notmuch-deliver/src/main.c |   10 +++++++---\r
+ 1 files changed, 7 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/contrib/notmuch-deliver/src/main.c b/contrib/notmuch-deliver/src/main.c\r
+index f7a4eaa..8423d91 100644\r
+--- a/contrib/notmuch-deliver/src/main.c\r
++++ b/contrib/notmuch-deliver/src/main.c\r
+@@ -252,9 +252,13 @@ save_maildir(int fdin, const char *dir, int auto_create, char **path)\r
\r
+       g_debug("Reading from standard input and writing to `%s'", info.tmpname);\r
+ #ifdef HAVE_SPLICE\r
+-      ret = g_getenv("NOTMUCH_DELIVER_NO_SPLICE")\r
+-              ? save_readwrite(fdin, fdout)\r
+-              : save_splice(fdin, fdout);\r
++      if (g_getenv("NOTMUCH_DELIVER_NO_SPLICE"))\r
++              ret = save_readwrite(fdin, fdout);\r
++      else {\r
++              ret = save_splice(fdin, fdout);\r
++              if (ret)\r
++                      ret = save_readwrite(fdin, fdout);\r
++      }\r
+ #else\r
+       ret = save_readwrite(fdin, fdout);\r
+ #endif /* HAVE_SPLICE */\r
+-- \r
+1.7.7.1\r
+\r