[PATCH 1/2] notmuch-deliver: Retry with readwrite if splice() fails
David Riebenbauer
davrieb at liegesta.at
Sat Nov 5 22:34:27 PDT 2011
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 */
--
1.7.7.1
More information about the notmuch
mailing list