mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-07-24 12:44:29 +08:00
copy_file also copies permissions
This commit is contained in:
parent
cd6805e94d
commit
ab8a78d806
@ -3956,6 +3956,14 @@ GHC_INLINE bool copy_file(const path& from, const path& to, copy_options options
|
|||||||
::close(in);
|
::close(in);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (st.permissions() != sf.permissions()) {
|
||||||
|
if (::fchmod(out, static_cast<int>(sf.permissions() & perms::all)) != 0) {
|
||||||
|
ec = detail::make_system_error();
|
||||||
|
::close(in);
|
||||||
|
::close(out);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
ssize_t br, bw;
|
ssize_t br, bw;
|
||||||
while ((br = ::read(in, buffer.data(), buffer.size())) > 0) {
|
while ((br = ::read(in, buffer.data(), buffer.size())) > 0) {
|
||||||
ssize_t offset = 0;
|
ssize_t offset = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user