summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2014-02-12 16:17:00 -0500
committerStephen Smalley <sds@tycho.nsa.gov>2014-02-19 09:15:09 -0500
commiteb3f421e028608e37e4eb814351f03b99ae55900 (patch)
tree030a4b7c930994a5bee836f0780aadf87dabac25 /init
parent27fd413d6d02a53c453cf926717b67e9a8d1eb32 (diff)
downloadsystem_core-eb3f421e028608e37e4eb814351f03b99ae55900.zip
system_core-eb3f421e028608e37e4eb814351f03b99ae55900.tar.gz
system_core-eb3f421e028608e37e4eb814351f03b99ae55900.tar.bz2
Enable building init with -Wall -Werror.
Eliminates various warnings from SELinux-related code. Bug: 12587913 Change-Id: I28921f0ebd934324436609540d95ccef58552b64 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Diffstat (limited to 'init')
-rw-r--r--init/init.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/init/init.c b/init/init.c
index 0250e97..1473fbc 100644
--- a/init/init.c
+++ b/init/init.c
@@ -934,12 +934,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()) {
@@ -1013,7 +1034,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;