ulog: avoid accidental /dev/kmsg creation
[project/libubox.git] / ulog.c
diff --git a/ulog.c b/ulog.c
index 66aad90298909b215a530c534ee0da02276a84dc..296605dde876f116217c228ef45a6ed4e77e61f2 100644 (file)
--- a/ulog.c
+++ b/ulog.c
@@ -90,7 +90,7 @@ static void ulog_kmsg(int priority, const char *fmt, va_list ap)
 {
        FILE *kmsg;
 
-       if ((kmsg = fopen("/dev/kmsg", "w")) != NULL) {
+       if ((kmsg = fopen("/dev/kmsg", "r+")) != NULL) {
                fprintf(kmsg, "<%u>", priority);
 
                if (_ulog_ident)