diff options
Diffstat (limited to 'libcutils/klog.c')
| -rw-r--r-- | libcutils/klog.c | 3 |
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); |
