From d410645aec7d51d49884a05863cf10497e43f0bc Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 27 Mar 2015 20:48:12 -0500 Subject: Minor cleanup of load_policy. --- toys/pending/load_policy.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'toys') 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); } -- cgit v1.2.3