diff options
author | Nick Kralevich <nnk@google.com> | 2014-02-19 19:13:39 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-02-19 19:13:39 +0000 |
commit | 066cde92d267986424ff79f35881116da3c672f8 (patch) | |
tree | d60cad56b7091bb23b63bece6adc68dc4b744250 /init/init.c | |
parent | bb2da79fdab68c9643a30f5156e7dcabb379b139 (diff) | |
parent | 223e07983718e1515f2a54542b9b0163a8f508ed (diff) | |
download | system_core-066cde92d267986424ff79f35881116da3c672f8.zip system_core-066cde92d267986424ff79f35881116da3c672f8.tar.gz system_core-066cde92d267986424ff79f35881116da3c672f8.tar.bz2 |
am 223e0798: Merge "Enable building init with -Wall -Werror."
* commit '223e07983718e1515f2a54542b9b0163a8f508ed':
Enable building init with -Wall -Werror.
Diffstat (limited to 'init/init.c')
-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; |