init: fix type of 2nd argument passed to prctl
prctl(PR_SET_SECUREBITS, ...) expects an unsigned long as its 2nd argument.
Passing in a int64_t happens to work with a 64-bit kernel, but does not
work with a 32-bit kernel.
Bug: 63680332
Test: boot 32-bit kernel; verify services with capabilities can successfully
set those capabilties
Change-Id: I60250d107a77b54b2e9fe3419b4480b921c7e2f8
Signed-off-by: Ben Fennema <fennema@google.com>
(cherry picked from commit a72436067d5f88885e4b32fa7c5d22f1ea8c0756)
diff --git a/init/service.cpp b/init/service.cpp
index 82dd9b1..fe38ee2 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -245,8 +245,8 @@
if (capabilities_.any() && uid_) {
// If Android is running in a container, some securebits might already
// be locked, so don't change those.
- int64_t securebits = prctl(PR_GET_SECUREBITS);
- if (securebits == -1) {
+ unsigned long securebits = prctl(PR_GET_SECUREBITS);
+ if (securebits == -1UL) {
PLOG(FATAL) << "prctl(PR_GET_SECUREBITS) failed for " << name_;
}
securebits |= SECBIT_KEEP_CAPS | SECBIT_KEEP_CAPS_LOCKED;