mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
Merge pull request #144 from actboy168/patch-2
copy_file also copies permissions
This commit is contained in:
commit
3afbd9c315
@ -3967,6 +3967,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<mode_t>(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