diff --git a/Userland/Utilities/chown.cpp b/Userland/Utilities/chown.cpp index d215577a9a..c0173d042e 100644 --- a/Userland/Utilities/chown.cpp +++ b/Userland/Utilities/chown.cpp @@ -21,14 +21,14 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio rpath chown")); String spec; - String path; + Vector paths; bool dont_follow_symlinks = false; Core::ArgsParser args_parser; args_parser.set_general_help("Change the ownership of a file or directory."); args_parser.add_option(dont_follow_symlinks, "Don't follow symlinks", "no-dereference", 'h'); args_parser.add_positional_argument(spec, "User and group IDs", "USER[:GROUP]"); - args_parser.add_positional_argument(path, "Path to file", "PATH"); + args_parser.add_positional_argument(paths, "Paths to files", "PATH"); args_parser.parse(arguments); uid_t new_uid = -1; @@ -66,10 +66,12 @@ ErrorOr serenity_main(Main::Arguments arguments) } } - if (dont_follow_symlinks) { - TRY(Core::System::lchown(path, new_uid, new_gid)); - } else { - TRY(Core::System::chown(path, new_uid, new_gid)); + for (auto path : paths) { + if (dont_follow_symlinks) { + TRY(Core::System::lchown(path, new_uid, new_gid)); + } else { + TRY(Core::System::chown(path, new_uid, new_gid)); + } } return 0;