commit | fe5b25132937963c8d9aef532bb0bb53bc0cea1f | [log] [tgz] |
---|---|---|
author | Nick Kralevich <nnk@google.com> | Tue May 19 22:01:05 2015 +0000 |
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | Tue May 19 22:01:06 2015 +0000 |
tree | cb021e84a9a679620564b16da42c50ed01b9dc3f | |
parent | 32685944b7c2379524d75cd6a21408e4ab18d55e [diff] | |
parent | 4d32a486fe62ef2c1440167604654a2f4e023fbd [diff] |
Merge "klog: don't unconditionally call mknod()"
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_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);