From 38903c0f88efefec3573d9ff3a8e28131da2f3b5 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 17 Feb 2017 13:38:47 -0800 Subject: [PATCH] Fix lshal cannot be run without root Root cause is invoking copy constructor on a Return 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 --- cmds/lshal/Timeout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 &interfaceObject, Function &&func, Args &&... args) { auto boundFunc = std::bind(std::forward(func), interfaceObject.get(), std::forward(args)...); bool success = timeout(IPC_CALL_WAIT, [&ret, &boundFunc] { - ret = boundFunc(); + ret = std::move(boundFunc()); }); if (!success) { return Status::fromStatusT(TIMED_OUT); -- 2.11.0