summaryrefslogtreecommitdiffstats
path: root/libcutils/klog.c
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2013-11-22 11:28:10 -0800
committerConley Owens <cco3@android.com>2013-11-22 13:44:43 -0800
commit66ed50af6870210ce013a5588a688434a5d48ee9 (patch)
treea879f3ea31083496d0efe491bc187b6e0ebada39 /libcutils/klog.c
parentdd2ac3de625e6c0328a0f70530d8ade0d2151bfc (diff)
parent536dea9d61a032e64bbe584a97463c6638ead009 (diff)
downloadsystem_core-66ed50af6870210ce013a5588a688434a5d48ee9.zip
system_core-66ed50af6870210ce013a5588a688434a5d48ee9.tar.gz
system_core-66ed50af6870210ce013a5588a688434a5d48ee9.tar.bz2
Merge commit '536dea9d61a032e64bbe584a97463c6638ead009' into HEAD
Change-Id: I5c469a4b738629d99d721cad7ded02d6c35f56d5
Diffstat (limited to 'libcutils/klog.c')
-rw-r--r--libcutils/klog.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libcutils/klog.c b/libcutils/klog.c
index 812af3b..d69fb10 100644
--- a/libcutils/klog.c
+++ b/libcutils/klog.c
@@ -40,6 +40,8 @@ void klog_init(void)
if (mknod(name, S_IFCHR | 0600, (1 << 8) | 11) == 0) {
klog_fd = open(name, O_WRONLY);
+ if (klog_fd < 0)
+ return;
fcntl(klog_fd, F_SETFD, FD_CLOEXEC);
unlink(name);
}
@@ -54,6 +56,7 @@ void klog_write(int level, const char *fmt, ...)
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);