aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/load_policy.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-03-27 20:48:12 -0500
committerRob Landley <rob@landley.net>2015-03-27 20:48:12 -0500
commitd410645aec7d51d49884a05863cf10497e43f0bc (patch)
tree0fe708e5eb8d031bc3f96cd98682ef3386496422 /toys/pending/load_policy.c
parenta89f05496c2b5f88f980a136fc9f9cc4c271584e (diff)
downloadtoybox-d410645aec7d51d49884a05863cf10497e43f0bc.tar.gz
Minor cleanup of load_policy.
Diffstat (limited to 'toys/pending/load_policy.c')
-rw-r--r--toys/pending/load_policy.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/toys/pending/load_policy.c b/toys/pending/load_policy.c
index ffe113e2..8c9b97ef 100644
--- a/toys/pending/load_policy.c
+++ b/toys/pending/load_policy.c
@@ -1,4 +1,4 @@
-/* runcon.c - Run command in specified security context
+/* load_policy.c - Load a policy file
*
* Copyright 2015 The Android Open Source Project
@@ -30,12 +30,8 @@ void load_policy_main(void)
close(fd);
}
- if (!policy_data) {
- error_exit("Couldn't read %s: %s", path, strerror(errno));
- }
-
- if (security_load_policy(policy_data, policy_len) < 0)
- error_exit("Couldn't load %s: %s", path, strerror(errno));
+ if (!policy_data || security_load_policy(policy_data, policy_len) < 0)
+ perror_exit("Couldn't %s %s: %s", policy_data ? "load" : "read", path);
munmap(policy_data, policy_len);
}