summaryrefslogtreecommitdiff
path: root/block_suspend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'block_suspend.cpp')
-rw-r--r--block_suspend.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/block_suspend.cpp b/block_suspend.cpp
index 18c93d4..d780904 100644
--- a/block_suspend.cpp
+++ b/block_suspend.cpp
@@ -34,7 +34,11 @@ int main(int argc, char ** /* argv */) {
return 0;
}
- android::wakelock::WakeLock wl{gWakeLockName}; // RAII object
+ auto wl = android::wakelock::WakeLock::tryGet(gWakeLockName); // RAII object
+ if (!wl.has_value()) {
+ return EXIT_FAILURE;
+ }
+
while (true) { sleep(1000000); };
std::abort(); // should never reach here
return 0;