diff --git a/Userland/Services/SpiceAgent/SpiceAgent.cpp b/Userland/Services/SpiceAgent/SpiceAgent.cpp index ff06168fef..2abbbef4e3 100644 --- a/Userland/Services/SpiceAgent/SpiceAgent.cpp +++ b/Userland/Services/SpiceAgent/SpiceAgent.cpp @@ -15,7 +15,7 @@ namespace SpiceAgent { ErrorOr> SpiceAgent::create(StringView device_path) { - auto device = TRY(Core::File::open(device_path, Core::File::OpenMode::ReadWrite | Core::File::OpenMode::Nonblocking)); + auto device = TRY(Core::File::open(device_path, Core::File::OpenMode::ReadWrite | Core::File::OpenMode::DontCreate | Core::File::OpenMode::Nonblocking)); return try_make(move(device), Vector { Capability::ClipboardByDemand }); } diff --git a/Userland/Services/SpiceAgent/main.cpp b/Userland/Services/SpiceAgent/main.cpp index bb78cebdb8..111c6b78d3 100644 --- a/Userland/Services/SpiceAgent/main.cpp +++ b/Userland/Services/SpiceAgent/main.cpp @@ -26,11 +26,8 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Desktop::Launcher::add_allowed_url(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory()))); TRY(Desktop::Launcher::seal_allowlist()); - // FIXME: Make Core::File support reading and writing, but without creating: - // By default, Core::File opens the file descriptor with O_CREAT when using OpenMode::Write (and subsequently, OpenMode::ReadWrite). - // To minimise confusion for people that have already used Core::File, we can probably just do `OpenMode::ReadWrite | OpenMode::DontCreate`. - TRY(Core::System::pledge("unix rpath wpath stdio sendfd recvfd cpath")); - TRY(Core::System::unveil(SPICE_DEVICE, "rwc"sv)); + TRY(Core::System::pledge("unix rpath wpath stdio sendfd recvfd")); + TRY(Core::System::unveil(SPICE_DEVICE, "rw"sv)); TRY(Core::System::unveil(Core::StandardPaths::downloads_directory(), "rwc"sv)); TRY(Core::System::unveil(nullptr, nullptr));