diff --git a/Userland/Services/CrashDaemon/CMakeLists.txt b/Userland/Services/CrashDaemon/CMakeLists.txt index f73989dd52..639c501a2f 100644 --- a/Userland/Services/CrashDaemon/CMakeLists.txt +++ b/Userland/Services/CrashDaemon/CMakeLists.txt @@ -9,4 +9,4 @@ set(SOURCES ) serenity_bin(CrashDaemon) -target_link_libraries(CrashDaemon LibC LibCompress LibCore LibCoredump) +target_link_libraries(CrashDaemon LibC LibCompress LibCore LibCoredump LibMain) diff --git a/Userland/Services/CrashDaemon/main.cpp b/Userland/Services/CrashDaemon/main.cpp index f89a32d75f..c9c84324f2 100644 --- a/Userland/Services/CrashDaemon/main.cpp +++ b/Userland/Services/CrashDaemon/main.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -49,19 +51,12 @@ static void launch_crash_reporter(const String& coredump_path, bool unlink_on_ex } } -int main() +ErrorOr serenity_main(Main::Arguments) { - if (pledge("stdio rpath wpath cpath proc exec", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio rpath wpath cpath proc exec", nullptr)); Core::BlockingFileWatcher watcher; - auto watch_result = watcher.add_watch("/tmp/coredump", Core::FileWatcherEvent::Type::ChildCreated); - if (watch_result.is_error()) { - warnln("Failed to watch the coredump directory: {}", watch_result.error()); - VERIFY_NOT_REACHED(); - } + TRY(watcher.add_watch("/tmp/coredump", Core::FileWatcherEvent::Type::ChildCreated)); while (true) { auto event = watcher.wait_for_event();