mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02: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:
Notes:
sideshowbarker
2024-07-16 23:38:54 +09:00
Author: https://github.com/cqundefine Commit: https://github.com/SerenityOS/serenity/commit/5e87b78935 Pull-request: https://github.com/SerenityOS/serenity/pull/23907 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/implicitfield Reviewed-by: https://github.com/nico Reviewed-by: https://github.com/timschumi ✅
@@ -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] = {
|
||||
|
||||
Reference in New Issue
Block a user