diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-23 16:41:42 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-04-13 11:32:46 +0200 |
commit | 7a23c7fdfe82754bebecf82cdb7e1ecb44d6f23f (patch) | |
tree | 36a73e538367598717363a0049be559b89cae4ec /src/basic/copy.h | |
parent | 5de6e1167314f5412285e904ec39299abbd352b5 (diff) | |
download | systemd-7a23c7fdfe82754bebecf82cdb7e1ecb44d6f23f.tar.gz |
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 880bd321cf..9ea1049f83 100644 --- a/src/basic/copy.h +++ b/src/basic/copy.h @@ -25,6 +25,9 @@ int copy_tree(const char *from, const char *to, uid_t override_uid, gid_t overri int copy_tree_at(int fdf, const char *from, int fdt, const char *to, uid_t override_uid, gid_t override_gid, CopyFlags copy_flags); int copy_directory_fd(int dirfd, const char *to, CopyFlags copy_flags); int copy_directory(const char *from, const char *to, CopyFlags copy_flags); -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); +} int copy_times(int fdf, int fdt); int copy_xattr(int fdf, int fdt); |