mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibFileSystem: Ignore ENOTSUP when using chown and chmod during copy
With FAT write support copying the file would show two errors because it does not support chown and chmod and would return ENOTSUP. After this commit these errors are ignored in that case.
This commit is contained in:
parent
2952401c58
commit
5e87b78935
1 changed files with 6 additions and 2 deletions
|
@ -223,10 +223,14 @@ ErrorOr<void> copy_file(StringView destination_path, StringView source_path, str
|
|||
if (!has_flag(preserve_mode, PreserveMode::Permissions))
|
||||
my_umask |= 06000;
|
||||
|
||||
TRY(Core::System::fchmod(destination->fd(), source_stat.st_mode & ~my_umask));
|
||||
if (auto result = Core::System::fchmod(destination->fd(), source_stat.st_mode & ~my_umask); result.is_error())
|
||||
if (result.error().is_errno() && result.error().code() != ENOTSUP)
|
||||
return result.release_error();
|
||||
|
||||
if (has_flag(preserve_mode, PreserveMode::Ownership))
|
||||
TRY(Core::System::fchown(destination->fd(), source_stat.st_uid, source_stat.st_gid));
|
||||
if (auto result = Core::System::fchown(destination->fd(), source_stat.st_uid, source_stat.st_gid); result.is_error())
|
||||
if (result.error().is_errno() && result.error().code() != ENOTSUP)
|
||||
return result.release_error();
|
||||
|
||||
if (has_flag(preserve_mode, PreserveMode::Timestamps)) {
|
||||
struct timespec times[2] = {
|
||||
|
|
Loading…
Add table
Reference in a new issue