summaryrefslogtreecommitdiff
path: root/Userland/Services/SpiceAgent/main.cpp
diff options
context:
space:
mode:
authorCaoimhe <caoimhebyrne06@gmail.com>2023-06-03 00:16:59 +0100
committerAndreas Kling <kling@serenityos.org>2023-06-03 05:52:16 +0200
commit4be5000c22a0cb1d7201f01a1c851783170ad2e2 (patch)
tree2fc73190787d2dcfc48668cc9211f8b39b138c4e /Userland/Services/SpiceAgent/main.cpp
parent13506a612e61a0455a61c2ec4bb19a43e0df32f4 (diff)
downloadserenity-4be5000c22a0cb1d7201f01a1c851783170ad2e2.zip
SpiceAgent: Exit early if `SPICE_DEVICE` doesn't exist
Diffstat (limited to 'Userland/Services/SpiceAgent/main.cpp')
-rw-r--r--Userland/Services/SpiceAgent/main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Services/SpiceAgent/main.cpp b/Userland/Services/SpiceAgent/main.cpp
index 111c6b78d3..a8520ef2b2 100644
--- a/Userland/Services/SpiceAgent/main.cpp
+++ b/Userland/Services/SpiceAgent/main.cpp
@@ -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));