mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
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.
This commit is contained in:
parent
c878081127
commit
9324e04a82
1 changed files with 6 additions and 5 deletions
|
@ -251,11 +251,12 @@ maildir_open_tmp_file (void *ctx, const char *dir,
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the contents of standard input (fdin) into fdout.
|
/*
|
||||||
* Returns TRUE if a non-empty file was written successfully.
|
* Copy fdin to fdout, return TRUE on success, and FALSE on errors and
|
||||||
* Otherwise, return FALSE. */
|
* empty input.
|
||||||
|
*/
|
||||||
static notmuch_bool_t
|
static notmuch_bool_t
|
||||||
copy_stdin (int fdin, int fdout)
|
copy_fd (int fdout, int fdin)
|
||||||
{
|
{
|
||||||
notmuch_bool_t empty = TRUE;
|
notmuch_bool_t empty = TRUE;
|
||||||
|
|
||||||
|
@ -308,7 +309,7 @@ write_message (void *ctx, int fdin, const char *dir, char **newpath)
|
||||||
|
|
||||||
cleanup_path = tmppath;
|
cleanup_path = tmppath;
|
||||||
|
|
||||||
if (! copy_stdin (fdin, fdout))
|
if (! copy_fd (fdout, fdin))
|
||||||
goto FAIL;
|
goto FAIL;
|
||||||
|
|
||||||
if (fsync (fdout) != 0) {
|
if (fsync (fdout) != 0) {
|
||||||
|
|
Loading…
Reference in a new issue