diff options
author | Nick Kralevich <nnk@google.com> | 2014-02-19 19:23:13 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-02-19 19:23:13 +0000 |
commit | 202be73b62e4adc65f7b192c6f374a073c500386 (patch) | |
tree | b0690247f9a45cafb72e8f7b8bb4264b711e316d /init | |
parent | b6391ce26b6e5f7360efc7aba0fac8455cba53b4 (diff) | |
parent | f10492d8c0c907fad6f87c871fec6b2fac41a02c (diff) | |
download | system_core-202be73b62e4adc65f7b192c6f374a073c500386.zip system_core-202be73b62e4adc65f7b192c6f374a073c500386.tar.gz system_core-202be73b62e4adc65f7b192c6f374a073c500386.tar.bz2 |
am f10492d8: am 066cde92: am 223e0798: Merge "Enable building init with -Wall -Werror."
* commit 'f10492d8c0c907fad6f87c871fec6b2fac41a02c':
Enable building init with -Wall -Werror.
Diffstat (limited to 'init')
-rw-r--r-- | init/init.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/init/init.c b/init/init.c index 00f4558..0884236 100644 --- a/init/init.c +++ b/init/init.c @@ -933,12 +933,33 @@ int selinux_reload_policy(void) return 0; } -int audit_callback(void *data, security_class_t cls, char *buf, size_t len) +static int audit_callback(void *data, security_class_t cls __attribute__((unused)), char *buf, size_t len) { snprintf(buf, len, "property=%s", !data ? "NULL" : (char *)data); return 0; } +static int log_callback(int type, const char *fmt, ...) +{ + int level; + va_list ap; + switch (type) { + case SELINUX_WARNING: + level = KLOG_WARNING_LEVEL; + break; + case SELINUX_INFO: + level = KLOG_INFO_LEVEL; + break; + default: + level = KLOG_ERROR_LEVEL; + break; + } + va_start(ap, fmt); + klog_vwrite(level, fmt, ap); + va_end(ap); + return 0; +} + static void selinux_initialize(void) { if (selinux_is_disabled()) { @@ -1012,7 +1033,7 @@ int main(int argc, char **argv) process_kernel_cmdline(); union selinux_callback cb; - cb.func_log = klog_write; + cb.func_log = log_callback; selinux_set_callback(SELINUX_CB_LOG, cb); cb.func_audit = audit_callback; |