Add fallback to stderr should /dev/kmsg be unavailable

diff --git a/klibc/syslog.c b/klibc/syslog.c
index 1573ee1..7432ded 100644
--- a/klibc/syslog.c
+++ b/klibc/syslog.c
@@ -39,10 +39,15 @@
   va_list ap;
   char buf[BUFLEN];
   int rv, len;
+  int fd;
 
   if ( __syslog_fd == -1 )
     openlog(NULL, 0, 0);
 
+  fd = __syslog_fd;
+  if ( fd == -1 )
+    fd = 2;			/* Failed to open log, write to stderr */
+
   buf[0] = '<';
   buf[1] = LOG_PRI(prio)+'0';
   buf[2] = '>';
@@ -59,5 +64,5 @@
   if ( len > BUFLEN-1 ) len = BUFLEN-1;
   buf[len] = '\n';
 
-  write(__syslog_fd, buf, len+1);
+  write(fd, buf, len+1);
 }
diff --git a/syslog.c b/syslog.c
index 1573ee1..7432ded 100644
--- a/syslog.c
+++ b/syslog.c
@@ -39,10 +39,15 @@
   va_list ap;
   char buf[BUFLEN];
   int rv, len;
+  int fd;
 
   if ( __syslog_fd == -1 )
     openlog(NULL, 0, 0);
 
+  fd = __syslog_fd;
+  if ( fd == -1 )
+    fd = 2;			/* Failed to open log, write to stderr */
+
   buf[0] = '<';
   buf[1] = LOG_PRI(prio)+'0';
   buf[2] = '>';
@@ -59,5 +64,5 @@
   if ( len > BUFLEN-1 ) len = BUFLEN-1;
   buf[len] = '\n';
 
-  write(__syslog_fd, buf, len+1);
+  write(fd, buf, len+1);
 }