diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-30 23:23:31 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-30 23:23:31 +0000 |
commit | 818d228f60fb8098a5fd12c49dc0cc80d42e850a (patch) | |
tree | 7ec44364cc0375be7051bf901d0cce7087212c31 | |
parent | 53ffe748273e4c08fb6bd5f1b76c751c78600e57 (diff) | |
parent | 8fe7b3dd3140521b0848fcb62243dc39125b4f4d (diff) | |
download | recovery-sdk-release.tar.gz |
Merge "Snap for 11785460 from 75014b82e2336838434b9b6f55d15392271484c1 to sdk-release" into sdk-releasesdk-release
-rw-r--r-- | otautil/include/otautil/sysutil.h | 2 | ||||
-rw-r--r-- | otautil/sysutil.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/otautil/include/otautil/sysutil.h b/otautil/include/otautil/sysutil.h index d0d2e67d..5c64cff1 100644 --- a/otautil/include/otautil/sysutil.h +++ b/otautil/include/otautil/sysutil.h @@ -106,7 +106,7 @@ class MemMapping { [[noreturn]] void Reboot(std::string_view target); // Triggers a shutdown. -bool Shutdown(std::string_view target); +[[noreturn]] void Shutdown(std::string_view target); // Returns a null-terminated char* array, where the elements point to the C-strings in the given // vector, plus an additional nullptr at the end. This is a helper function that facilitates diff --git a/otautil/sysutil.cpp b/otautil/sysutil.cpp index b3ead973..2c7752e9 100644 --- a/otautil/sysutil.cpp +++ b/otautil/sysutil.cpp @@ -233,9 +233,13 @@ void Reboot(std::string_view target) { while (true) pause(); } -bool Shutdown(std::string_view target) { +void Shutdown(std::string_view target) { std::string cmd = "shutdown," + std::string(target); - return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); + if (!android::base::SetProperty(ANDROID_RB_PROPERTY, cmd)) { + LOG(FATAL) << "Shutdown failed"; + } + + while (true) pause(); } std::vector<char*> StringVectorToNullTerminatedArray(const std::vector<std::string>& args) { |