init: powerd: Fix race condition with device disconnect
If a device becomes disconnected after the "-e" check but before the
chown command, we will return with fail status and powerd will not be
started. Fix this by ensuring chown failure will not abort our script.
BUG=chrome-os-partner:28827
TEST=Manual. Ensure powerd starts on boot.
Change-Id: I2ec4d1a22461661f2601a1338337e97a3c45e7e4
Reviewed-on: https://chromium-review.googlesource.com/203747
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Derek Basehore <dbasehore@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
diff --git a/init/powerd.conf b/init/powerd.conf
index 773ac48..f5a1720 100644
--- a/init/powerd.conf
+++ b/init/powerd.conf
@@ -36,7 +36,7 @@
$(find /sys/devices/ -name "dark_resume_source"); do
# Test for existence to skip over wildcards that didn't match anything.
if [ -e "${FILE}" ]; then
- chown power:power "${FILE}"
+ chown power:power "${FILE}" || true
fi
done
end script