aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2014-09-22 11:54:55 +0200
committerGravatar David Bremner <david@tethera.net>2014-09-24 20:20:19 +0200
commit9324e04a82e8d483e1cb334138ba64fc4b721513 (patch)
tree3536920fdc82665edbbb04707731c9d847e938f7
parentc878081127f48c393835b6f067f8f85beda9ff29 (diff)
cli/insert: rename file copy function
The copying has nothing to do with stdin, so call it copy_fd instead. While at it, improve documentation and reverse the parameters, as destination is traditionally the first parameter.
-rw-r--r--notmuch-insert.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/notmuch-insert.c b/notmuch-insert.c
index ccb091ac..5d478064 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -251,11 +251,12 @@ maildir_open_tmp_file (void *ctx, const char *dir,
return fd;
}
-/* Copy the contents of standard input (fdin) into fdout.
- * Returns TRUE if a non-empty file was written successfully.
- * Otherwise, return FALSE. */
+/*
+ * Copy fdin to fdout, return TRUE on success, and FALSE on errors and
+ * empty input.
+ */
static notmuch_bool_t
-copy_stdin (int fdin, int fdout)
+copy_fd (int fdout, int fdin)
{
notmuch_bool_t empty = TRUE;
@@ -308,7 +309,7 @@ write_message (void *ctx, int fdin, const char *dir, char **newpath)
cleanup_path = tmppath;
- if (! copy_stdin (fdin, fdout))
+ if (! copy_fd (fdout, fdin))
goto FAIL;
if (fsync (fdout) != 0) {