aboutsummaryrefslogtreecommitdiff
path: root/toys/android/load_policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/android/load_policy.c')
-rw-r--r--toys/android/load_policy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/android/load_policy.c b/toys/android/load_policy.c
index d9ff1486..bc0d5640 100644
--- a/toys/android/load_policy.c
+++ b/toys/android/load_policy.c
@@ -21,11 +21,11 @@ void load_policy_main(void)
{
int fd = xopenro(*toys.optargs);
off_t policy_len = fdlength(fd);
- char *policy_data = mmap(0, policy_len, PROT_READ, MAP_PRIVATE, fd, 0);
+ char *policy_data = xmmap(0, policy_len, PROT_READ, MAP_PRIVATE, fd, 0);
close(fd);
- if (!policy_data || security_load_policy(policy_data, policy_len) < 0)
- perror_exit("Couldn't %s %s", policy_data ? "load" : "read", *toys.optargs);
+ if (security_load_policy(policy_data, policy_len) < 0)
+ perror_exit("security_load_policy %s", *toys.optargs);
munmap(policy_data, policy_len);
}