From eb3f421e028608e37e4eb814351f03b99ae55900 Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Wed, 12 Feb 2014 16:17:00 -0500 Subject: Enable building init with -Wall -Werror. Eliminates various warnings from SELinux-related code. Bug: 12587913 Change-Id: I28921f0ebd934324436609540d95ccef58552b64 Signed-off-by: Stephen Smalley --- libcutils/klog.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libcutils') diff --git a/libcutils/klog.c b/libcutils/klog.c index d69fb10..d3c40df 100644 --- a/libcutils/klog.c +++ b/libcutils/klog.c @@ -49,18 +49,24 @@ void klog_init(void) #define LOG_BUF_MAX 512 -void klog_write(int level, const char *fmt, ...) +void klog_vwrite(int level, const char *fmt, va_list ap) { char buf[LOG_BUF_MAX]; - va_list ap; if (level > klog_level) return; if (klog_fd < 0) klog_init(); if (klog_fd < 0) return; - va_start(ap, fmt); vsnprintf(buf, LOG_BUF_MAX, fmt, ap); buf[LOG_BUF_MAX - 1] = 0; - va_end(ap); + write(klog_fd, buf, strlen(buf)); } + +void klog_write(int level, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + klog_vwrite(level, fmt, ap); + va_end(ap); +} -- cgit v1.1