summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yifan Hong <elsk@google.com> 2017-02-17 13:38:47 -0800
committer Yifan Hong <elsk@google.com> 2017-02-17 14:56:19 -0800
commit38903c0f88efefec3573d9ff3a8e28131da2f3b5 (patch)
tree503be85765616c7dbb400cd7b58564d94569c355
parent9753b433552f3856dc9e3a022dd6cfaa72f273d0 (diff)
Fix lshal cannot be run without root
Root cause is invoking copy constructor on a Return<T> object implicitly, while the old object contains a failed status and gets destroyed. Use the move constructor instead to fix this. Test: adb unroot && adb shell lshal Change-Id: I44710166cc5d7da30bf54b10d1860be1b91dc98a
-rw-r--r--cmds/lshal/Timeout.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds/lshal/Timeout.h b/cmds/lshal/Timeout.h
index bf883c0a4c..001c3d6790 100644
--- a/cmds/lshal/Timeout.h
+++ b/cmds/lshal/Timeout.h
@@ -69,7 +69,7 @@ timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) {
auto boundFunc = std::bind(std::forward<Function>(func),
interfaceObject.get(), std::forward<Args>(args)...);
bool success = timeout(IPC_CALL_WAIT, [&ret, &boundFunc] {
- ret = boundFunc();
+ ret = std::move(boundFunc());
});
if (!success) {
return Status::fromStatusT(TIMED_OUT);