diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-23 16:41:42 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 26e21636556e1950038226e2a5c58dbc46dced30 (patch) | |
tree | a730a7b5624697b5db66124aed67b5501802ab79 /src/basic/copy.h | |
parent | 0c28c8723ac7d39dbba1b9679fb0d4bc16d83ab0 (diff) |
copy: extend copy_bytes() a bit
Optionally, when we copy between fds with simple read/write, let's
return any remaining data we already read into the buffer if write
fails. This is useful to allow callers to use the read data otherwise,
perhaps implementing a different fallback for copying.
Diffstat (limited to 'src/basic/copy.h')
-rw-r--r-- | src/basic/copy.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/copy.h b/src/basic/copy.h index d8cb00c67..faec04578 100644 --- a/src/basic/copy.h +++ b/src/basic/copy.h @@ -27,7 +27,10 @@ int copy_tree_at(int fdf, const char *from, int fdt, const char *to, uid_t overr int copy_directory_fd(int dirfd, const char *to, CopyFlags copy_flags); int copy_directory(const char *from, const char *to, CopyFlags copy_flags); #endif // 0 -int copy_bytes(int fdf, int fdt, uint64_t max_bytes, CopyFlags copy_flags); +int copy_bytes_full(int fdf, int fdt, uint64_t max_bytes, CopyFlags copy_flags, void **ret_remains, size_t *ret_remains_size); +static inline int copy_bytes(int fdf, int fdt, uint64_t max_bytes, CopyFlags copy_flags) { + return copy_bytes_full(fdf, fdt, max_bytes, copy_flags, NULL, NULL); +} #if 0 /// UNNEEDED by elogind int copy_times(int fdf, int fdt); int copy_xattr(int fdf, int fdt); |