--- /dev/null
+Return-Path: <jani@nikula.org>\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 E856B431FC0\r
+ for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 02:55:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 f8KYWg97Tttb for <notmuch@notmuchmail.org>;\r
+ Mon, 22 Sep 2014 02:55:02 -0700 (PDT)\r
+Received: from mail-we0-f180.google.com (mail-we0-f180.google.com\r
+ [74.125.82.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 05017431FD0\r
+ for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 02:54:53 -0700 (PDT)\r
+Received: by mail-we0-f180.google.com with SMTP id u56so2583109wes.25\r
+ for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 02:54:52 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=P9e7ZaLq41xEXo51NDDCfSXP57SgGz+bE5dNFBHRAq8=;\r
+ b=DnLCDO8qm+EJXxSvhnNjeXYsTBtD6vBNysesmrGT87skAaccN0yDVaBwA/meGCgdxl\r
+ NOCGSNFDHaR7jLPfk3m6KEpy5OEvZPC9mPLKgNVCaQYso8/YrKBmxoabHoBSv9P50OIn\r
+ 5WrrPwD4nR1WXCQu2J8OlVngdLaogusWI2rVoL3acC0JD3OAee31SsWfnmC4C2gzkofV\r
+ 7Pm+7QZDAijlYEo5QNIoPmD02c9x3zck4IrtbQ9jxk6DawOFb0qvosRzNu63goStgR/V\r
+ aV0cuBer9+UaqqM/vRvYJOKKzlLU2QGsdUeb69eHb2l17GTJqCUwCfzenaERNefBitIZ\r
+ mlrw==\r
+X-Gm-Message-State:\r
+ ALoCoQknu/SWX8DGTrK7CWRJAp27zB8/8Wkk/jYQe01XEXPpWyXJ4X1SRHtdbJVF6LsE95FcUur7\r
+X-Received: by 10.194.119.193 with SMTP id kw1mr2859680wjb.82.1411379692925;\r
+ Mon, 22 Sep 2014 02:54:52 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+ by mx.google.com with ESMTPSA id hm5sm11747345wjb.2.2014.09.22.02.54.52\r
+ for <multiple recipients>\r
+ (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+ Mon, 22 Sep 2014 02:54:52 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 04/11] cli/insert: rename file copy function\r
+Date: Mon, 22 Sep 2014 11:54:55 +0200\r
+Message-Id:\r
+ <250d83c50e2fbca0d6cc49f96927c200aa7f1720.1411379395.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.2.5\r
+In-Reply-To: <cover.1411379395.git.jani@nikula.org>\r
+References: <cover.1411379395.git.jani@nikula.org>\r
+In-Reply-To: <cover.1411379395.git.jani@nikula.org>\r
+References: <cover.1411379395.git.jani@nikula.org>\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: Mon, 22 Sep 2014 09:55:07 -0000\r
+\r
+The copying has nothing to do with stdin, so call it copy_fd\r
+instead. While at it, improve documentation and reverse the\r
+parameters, as destination is traditionally the first parameter.\r
+---\r
+ notmuch-insert.c | 11 ++++++-----\r
+ 1 files changed, 6 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/notmuch-insert.c b/notmuch-insert.c\r
+index ccb091a..5d47806 100644\r
+--- a/notmuch-insert.c\r
++++ b/notmuch-insert.c\r
+@@ -251,11 +251,12 @@ maildir_open_tmp_file (void *ctx, const char *dir,\r
+ return fd;\r
+ }\r
+ \r
+-/* Copy the contents of standard input (fdin) into fdout.\r
+- * Returns TRUE if a non-empty file was written successfully.\r
+- * Otherwise, return FALSE. */\r
++/*\r
++ * Copy fdin to fdout, return TRUE on success, and FALSE on errors and\r
++ * empty input.\r
++ */\r
+ static notmuch_bool_t\r
+-copy_stdin (int fdin, int fdout)\r
++copy_fd (int fdout, int fdin)\r
+ {\r
+ notmuch_bool_t empty = TRUE;\r
+ \r
+@@ -308,7 +309,7 @@ write_message (void *ctx, int fdin, const char *dir, char **newpath)\r
+ \r
+ cleanup_path = tmppath;\r
+ \r
+- if (! copy_stdin (fdin, fdout))\r
++ if (! copy_fd (fdout, fdin))\r
+ goto FAIL;\r
+ \r
+ if (fsync (fdout) != 0) {\r
+-- \r
+1.7.2.5\r
+\r