From 99451b14b2e92c4e3a5e16c0c2b0f7d946c0507b Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 24 Apr 2023 10:52:26 +0200 Subject: [PATCH] Aplay: Determine absolute path before first `unveil` `Core::DeprecatedFile::absolute_path` uses `stat` to determine whether a file exists, which will always fail after the first `unveil` call `aplay` does. Reorder things so we don't get a stack trace thrown at us for each file being played. --- Userland/Utilities/aplay.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/aplay.cpp b/Userland/Utilities/aplay.cpp index 20884b1417..4e981b8971 100644 --- a/Userland/Utilities/aplay.cpp +++ b/Userland/Utilities/aplay.cpp @@ -35,8 +35,10 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_option(show_sample_progress, "Show playback progress in samples", "sample-progress", 's'); args_parser.parse(arguments); + auto absolute_path = Core::DeprecatedFile::absolute_path(path); + TRY(Core::System::unveil("/tmp/session/%sid/portal/audio", "rw")); - TRY(Core::System::unveil(Core::DeprecatedFile::absolute_path(path), "r"sv)); + TRY(Core::System::unveil(absolute_path, "r"sv)); TRY(Core::System::unveil(nullptr, nullptr)); Core::EventLoop loop;