From patchwork Sun Nov 6 05:34:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] notmuch-deliver: Retry with readwrite if splice() fails Date: Sun, 06 Nov 2011 04:34:27 -0000 From: David Riebenbauer X-Patchwork-Id: 1456 Message-Id: <1320557668-2314-1-git-send-email-davrieb@liegesta.at> To: Notmuch Mailing List notmuch-deliver should not just fail, when splice() doesn't work. Fall back to the readwrite method even if NOTMUCH_DELIVER_NO_SPLICE is not set. --- contrib/notmuch-deliver/src/main.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/notmuch-deliver/src/main.c b/contrib/notmuch-deliver/src/main.c index f7a4eaa..8423d91 100644 --- a/contrib/notmuch-deliver/src/main.c +++ b/contrib/notmuch-deliver/src/main.c @@ -252,9 +252,13 @@ save_maildir(int fdin, const char *dir, int auto_create, char **path) g_debug("Reading from standard input and writing to `%s'", info.tmpname); #ifdef HAVE_SPLICE - ret = g_getenv("NOTMUCH_DELIVER_NO_SPLICE") - ? save_readwrite(fdin, fdout) - : save_splice(fdin, fdout); + if (g_getenv("NOTMUCH_DELIVER_NO_SPLICE")) + ret = save_readwrite(fdin, fdout); + else { + ret = save_splice(fdin, fdout); + if (ret) + ret = save_readwrite(fdin, fdout); + } #else ret = save_readwrite(fdin, fdout); #endif /* HAVE_SPLICE */