Loading init/builtins.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -1018,7 +1018,11 @@ static Result<Success> ExecWithRebootOnFailure(const std::string& reboot_reason, if (siginfo.si_code != CLD_EXITED || siginfo.si_status != 0) { if (e4crypt_is_native()) { LOG(ERROR) << "Rebooting into recovery, reason: " << reboot_reason; reboot_into_recovery({"--prompt_and_wipe_data", "--reason="s + reboot_reason}); if (auto result = reboot_into_recovery( {"--prompt_and_wipe_data", "--reason="s + reboot_reason}); !result) { LOG(FATAL) << "Could not reboot into recovery: " << result.error(); } } else { LOG(ERROR) << "Failure (reboot suppressed): " << reboot_reason; } Loading init/keychords.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ Keychords::Keychords() : epoll_(nullptr), inotify_fd_(-1) {} Keychords::~Keychords() noexcept { if (inotify_fd_ >= 0) { epoll_->UnregisterHandler(inotify_fd_); epoll_->UnregisterHandler(inotify_fd_).IgnoreError(); ::close(inotify_fd_); } while (!registration_.empty()) GeteventCloseDevice(registration_.begin()->first); Loading Loading @@ -186,7 +186,11 @@ bool Keychords::GeteventEnable(int fd) { current_ |= mask & available & set; LambdaCheck(); } epoll_->RegisterHandler(fd, [this, fd]() { this->LambdaHandler(fd); }); if (auto result = epoll_->RegisterHandler(fd, [this, fd]() { this->LambdaHandler(fd); }); !result) { LOG(WARNING) << "Could not register keychord epoll handler: " << result.error(); return false; } return true; } Loading @@ -208,7 +212,7 @@ void Keychords::GeteventCloseDevice(const std::string& device) { auto it = registration_.find(device); if (it == registration_.end()) return; auto fd = (*it).second; epoll_->UnregisterHandler(fd); epoll_->UnregisterHandler(fd).IgnoreError(); registration_.erase(it); ::close(fd); } Loading Loading @@ -266,7 +270,11 @@ void Keychords::GeteventOpenDevice() { } if (inotify_fd_ >= 0) { if (auto result = epoll_->RegisterHandler(inotify_fd_, [this]() { this->InotifyHandler(); }); !result) { LOG(WARNING) << "Could not register keychord epoll handler: " << result.error(); } } } Loading init/keychords_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -213,7 +213,7 @@ TestFrame::TestFrame(const std::vector<const std::vector<int>>& chords, EventHan } void TestFrame::RelaxForMs(std::chrono::milliseconds wait) { epoll_.Wait(wait); epoll_.Wait(wait).IgnoreError(); } void TestFrame::SetChord(int key, bool value) { Loading init/reboot.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,9 @@ static void TurnOffBacklight() { LOG(WARNING) << "cannot find blank_screen in TurnOffBacklight"; return; } service->Start(); if (auto result = service->Start(); !result) { LOG(WARNING) << "Could not start blank_screen service: " << result.error(); } } static void ShutdownVold() { Loading init/result.h +3 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ inline Error ErrnoError() { } template <typename T> class Result { class [[nodiscard]] Result { public: Result() {} Loading @@ -170,6 +170,8 @@ class Result { : contents_(std::in_place_index_t<1>(), std::move(result_error.error_string), result_error.error_errno) {} void IgnoreError() const {} bool has_value() const { return contents_.index() == 0; } T& value() & { return std::get<0>(contents_); } Loading Loading
init/builtins.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -1018,7 +1018,11 @@ static Result<Success> ExecWithRebootOnFailure(const std::string& reboot_reason, if (siginfo.si_code != CLD_EXITED || siginfo.si_status != 0) { if (e4crypt_is_native()) { LOG(ERROR) << "Rebooting into recovery, reason: " << reboot_reason; reboot_into_recovery({"--prompt_and_wipe_data", "--reason="s + reboot_reason}); if (auto result = reboot_into_recovery( {"--prompt_and_wipe_data", "--reason="s + reboot_reason}); !result) { LOG(FATAL) << "Could not reboot into recovery: " << result.error(); } } else { LOG(ERROR) << "Failure (reboot suppressed): " << reboot_reason; } Loading
init/keychords.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ Keychords::Keychords() : epoll_(nullptr), inotify_fd_(-1) {} Keychords::~Keychords() noexcept { if (inotify_fd_ >= 0) { epoll_->UnregisterHandler(inotify_fd_); epoll_->UnregisterHandler(inotify_fd_).IgnoreError(); ::close(inotify_fd_); } while (!registration_.empty()) GeteventCloseDevice(registration_.begin()->first); Loading Loading @@ -186,7 +186,11 @@ bool Keychords::GeteventEnable(int fd) { current_ |= mask & available & set; LambdaCheck(); } epoll_->RegisterHandler(fd, [this, fd]() { this->LambdaHandler(fd); }); if (auto result = epoll_->RegisterHandler(fd, [this, fd]() { this->LambdaHandler(fd); }); !result) { LOG(WARNING) << "Could not register keychord epoll handler: " << result.error(); return false; } return true; } Loading @@ -208,7 +212,7 @@ void Keychords::GeteventCloseDevice(const std::string& device) { auto it = registration_.find(device); if (it == registration_.end()) return; auto fd = (*it).second; epoll_->UnregisterHandler(fd); epoll_->UnregisterHandler(fd).IgnoreError(); registration_.erase(it); ::close(fd); } Loading Loading @@ -266,7 +270,11 @@ void Keychords::GeteventOpenDevice() { } if (inotify_fd_ >= 0) { if (auto result = epoll_->RegisterHandler(inotify_fd_, [this]() { this->InotifyHandler(); }); !result) { LOG(WARNING) << "Could not register keychord epoll handler: " << result.error(); } } } Loading
init/keychords_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -213,7 +213,7 @@ TestFrame::TestFrame(const std::vector<const std::vector<int>>& chords, EventHan } void TestFrame::RelaxForMs(std::chrono::milliseconds wait) { epoll_.Wait(wait); epoll_.Wait(wait).IgnoreError(); } void TestFrame::SetChord(int key, bool value) { Loading
init/reboot.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,9 @@ static void TurnOffBacklight() { LOG(WARNING) << "cannot find blank_screen in TurnOffBacklight"; return; } service->Start(); if (auto result = service->Start(); !result) { LOG(WARNING) << "Could not start blank_screen service: " << result.error(); } } static void ShutdownVold() { Loading
init/result.h +3 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ inline Error ErrnoError() { } template <typename T> class Result { class [[nodiscard]] Result { public: Result() {} Loading @@ -170,6 +170,8 @@ class Result { : contents_(std::in_place_index_t<1>(), std::move(result_error.error_string), result_error.error_errno) {} void IgnoreError() const {} bool has_value() const { return contents_.index() == 0; } T& value() & { return std::get<0>(contents_); } Loading