SpiceAgent: Exit early if SPICE_DEVICE doesn't exist

This commit is contained in:
Caoimhe 2023-06-03 00:16:59 +01:00 committed by Andreas Kling
parent 13506a612e
commit 4be5000c22
Notes: sideshowbarker 2024-07-17 00:59:43 +09:00

View File

@ -10,6 +10,7 @@
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibGUI/Application.h>
#include <LibGUI/Clipboard.h>
#include <LibIPC/ConnectionToServer.h>
@ -20,6 +21,10 @@ static constexpr auto SPICE_DEVICE = "/dev/hvc0p1"sv;
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
if (!FileSystem::exists(SPICE_DEVICE)) {
return Error::from_string_literal("Failed to find spice device file!");
}
// We use the application to be able to easily write to the user's clipboard.
auto app = TRY(GUI::Application::create(arguments));