summaryrefslogtreecommitdiffstats
path: root/libcutils/klog.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcutils/klog.c')
-rw-r--r--libcutils/klog.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libcutils/klog.c b/libcutils/klog.c
index f574f08..710dc66 100644
--- a/libcutils/klog.c
+++ b/libcutils/klog.c
@@ -40,6 +40,11 @@ void klog_set_level(int level) {
void klog_init(void) {
if (klog_fd >= 0) return; /* Already initialized */
+ klog_fd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
+ if (klog_fd >= 0) {
+ return;
+ }
+
static const char* name = "/dev/__kmsg__";
if (mknod(name, S_IFCHR | 0600, (1 << 8) | 11) == 0) {
klog_fd = open(name, O_WRONLY | O_CLOEXEC);